diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp index 275148494..206f04158 100644 --- a/dialogs/exportdialog.cpp +++ b/dialogs/exportdialog.cpp @@ -329,8 +329,12 @@ void ExportDialog::prep_ui_for_render(bool rendering) { ui->renderCancel->setEnabled(rendering); } -void ExportDialog::on_pushButton_clicked() -{ +void ExportDialog::on_pushButton_clicked() { + if (ui->widthSpinbox->value()%2 == 1 || ui->heightSpinbox->value()%2 == 1) { + QMessageBox::critical(this, "Invalid dimensions", "Export width and height must both be even numbers/divisible by 2.", QMessageBox::Ok); + return; + } + QString ext; switch (ui->formatCombobox->currentIndex()) { case FORMAT_3GPP: diff --git a/io/exportthread.cpp b/io/exportthread.cpp index f46b81245..332ea5bca 100644 --- a/io/exportthread.cpp +++ b/io/exportthread.cpp @@ -139,6 +139,7 @@ bool ExportThread::setupVideo() { video_frame->width = sequence->width; video_frame->height = sequence->height; av_frame_get_buffer(video_frame, 0); + qDebug() << video_frame->linesize[0] << video_frame->linesize[1] << video_frame->linesize[2]; av_init_packet(&video_pkt); @@ -331,7 +332,7 @@ void ExportThread::run() { double timecode_secs = (double) (panel_timeline->playhead-start_frame) / sequence->frame_rate; if (video_enabled) { // get image from opengl - glReadPixels(0, 0, sequence->width, sequence->height, GL_RGBA, GL_UNSIGNED_BYTE, video_frame->data[0]); + glReadPixels(0, 0, video_frame->linesize[0]/4, sequence->height, GL_RGBA, GL_UNSIGNED_BYTE, video_frame->data[0]); // change pixel format sws_scale(sws_ctx, video_frame->data, video_frame->linesize, 0, video_frame->height, sws_frame->data, sws_frame->linesize); diff --git a/playback/cacher.cpp b/playback/cacher.cpp index acb7e93d8..d2155d174 100644 --- a/playback/cacher.cpp +++ b/playback/cacher.cpp @@ -332,7 +332,7 @@ void open_clip_worker(Clip* clip) { if (av_frame_get_buffer(clip->cache_A.frames[i], 0)) { qDebug() << "[ERROR] Could not allocate buffer for sws_frame"; } - clip->cache_A.frames[i]->linesize[0] = dstW*4; +// clip->cache_A.frames[i]->linesize[0] = dstW*4; clip->cache_B.frames[i] = av_frame_alloc(); av_frame_make_writable(clip->cache_B.frames[i]); @@ -342,7 +342,7 @@ void open_clip_worker(Clip* clip) { if (av_frame_get_buffer(clip->cache_B.frames[i], 0)) { qDebug() << "[ERROR] Could not allocate buffer for sws_frame"; } - clip->cache_B.frames[i]->linesize[0] = dstW*4; +// clip->cache_B.frames[i]->linesize[0] = dstW*4; } } else if (clip->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { // if FFmpeg can't pick up the channel layout (usually WAV), assume diff --git a/playback/playback.cpp b/playback/playback.cpp index d29759bc2..88b9df808 100644 --- a/playback/playback.cpp +++ b/playback/playback.cpp @@ -190,7 +190,9 @@ bool get_clip_frame(Clip* c, long playhead) { c->texture->allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8); } + glPixelStorei(GL_UNPACK_ROW_LENGTH, current_frame->linesize[0]/4); c->texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, current_frame->data[0]); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); c->texture_frame = clip_time; return true; diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index c815c3711..e2c75d405 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -226,7 +226,7 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) { coords.vertexTopRightX = coords.vertexBottomRightX = video_width/2; coords.vertexBottomLeftY = coords.vertexBottomRightY = video_height/2; coords.textureTopLeftY = coords.textureTopRightY = coords.textureTopLeftX = coords.textureBottomLeftX = 0; - coords.textureBottomLeftY = coords.textureBottomRightY = coords.textureTopRightX = coords.textureBottomRightX = 1.0; + coords.textureBottomLeftY = coords.textureBottomRightY = coords.textureTopRightX = coords.textureBottomRightX = 1.0; // EFFECT CODE START for (int j=0;jeffects.size();j++) {