From: Good Guy Date: Thu, 27 Apr 2017 21:09:48 +0000 (-0600) Subject: DAR ffmpeg encode fix, x264/x265 upgrade, match output size, ffmpeg view preloads X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=9dfcb16de981999e51887810e8e4c5cd6e77cde7;p=goodguy%2Fhistory.git DAR ffmpeg encode fix, x264/x265 upgrade, match output size, ffmpeg view preloads --- diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index 76892b71..14b978c1 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -263,6 +263,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char double new_samplerate = session->sample_rate; double new_framerate = session->frame_rate; + edl->retrack(); edl->rechannel(); edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO); edl->resample(old_framerate, new_framerate, TRACK_VIDEO); diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index 055b4ca5..6a870a72 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -262,6 +262,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const ch double new_samplerate = session->sample_rate; double new_framerate = session->frame_rate; + edl->retrack(); edl->rechannel(); edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO); edl->resample(old_framerate, new_framerate, TRACK_VIDEO); diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 41ee55b4..cf1d0968 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -38,6 +38,7 @@ #include "interlacemodes.h" #include "labels.h" #include "localsession.h" +#include "maskautos.h" #include "mutex.h" #include "nestededls.h" #include "panauto.h" @@ -669,6 +670,26 @@ int EDL::copy(double start, return 0; } +void EDL::retrack() +{ + int min_w = session->output_w, min_h = session->output_h; + for( Track *track=tracks->first; track!=0; track=track->next ) { + if( track->data_type != TRACK_VIDEO ) continue; + int w = min_w, h = min_h; + for( Edit *current=track->edits->first; current!=0; current=NEXT ) { + Indexable* indexable = current->get_source(); + if( !indexable ) continue; + int edit_w = indexable->get_w(), edit_h = indexable->get_h(); + if( w < edit_w ) w = edit_w; + if( h < edit_h ) h = edit_h; + } + if( track->track_w == w && track->track_h == h ) continue; + ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])-> + translate_masks( (w - track->track_w) / 2, (h - track->track_h) / 2); + track->track_w = w; track->track_h = h; + } +} + void EDL::rechannel() { for(Track *current = tracks->first; current; current = NEXT) diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index dbafb41e..0000e3f7 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -97,6 +97,8 @@ public: // Convert position to frames if cursor alignment is enabled double align_to_frame(double position, int round); +// increase track w/h to at least session w/h + void retrack(); // Scale all sample values since everything is locked to audio void rechannel(); void resample(double old_rate, double new_rate, int data_type); diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 70ccc272..968cb051 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -549,7 +549,7 @@ int FFStream::seek(int64_t no, double rate) } } if( ret < 0 ) { -//printf("** seek fail %ld, %ld\n", pos, tstmp); +printf("** seek fail %ld, %ld\n", pos, tstmp); seeked = need_packet = 0; st_eof(flushed=1); return -1; @@ -1214,7 +1214,7 @@ AVRational FFMPEG::to_sample_aspect_ratio(Asset *asset) { #if 1 double display_aspect = asset->width / (double)asset->height; - double sample_aspect = asset->aspect_ratio / display_aspect; + double sample_aspect = display_aspect / asset->aspect_ratio; int width = 1000000, height = width * sample_aspect + 0.5; float w, h; MWindow::create_aspect_ratio(w, h, width, height); diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index d4f89e6c..5542c975 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -1064,6 +1064,9 @@ void FFOptions::initialize(FFOptionsWindow *win, int kind) if( dupl ) continue; FFOptions_Opt *fopt = new FFOptions_Opt(this, opt, opt->name); append(fopt); + AVDictionaryEntry *elem = av_dict_get(win->dialog->ff_opts, + opt->name, 0, AV_DICT_IGNORE_SUFFIX); + if( elem && elem->value ) fopt->set(elem->value); char val[BCTEXTLEN], *vp = fopt->get(val, sizeof(val)); fopt->item_value->update(vp); } diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 577f229e..478c845c 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -3597,6 +3597,7 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra else if( delete_tracks ) edl->tracks->delete_track(track); } + edl->retrack(); edl->resample(old_framerate, session->frame_rate, TRACK_VIDEO); } if( !result && asset->audio_data && asset->channels > 0 ) { diff --git a/cinelerra-5.1/cinelerra/setformat.C b/cinelerra-5.1/cinelerra/setformat.C index 413fa950..af834397 100644 --- a/cinelerra-5.1/cinelerra/setformat.C +++ b/cinelerra-5.1/cinelerra/setformat.C @@ -159,6 +159,7 @@ void SetFormatThread::apply_changes() mwindow->edl->copy_session(new_settings, 1); mwindow->edl->session->output_w = dimension[0]; mwindow->edl->session->output_h = dimension[1]; + mwindow->edl->retrack(); mwindow->edl->rechannel(); mwindow->edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO); mwindow->edl->resample(old_framerate, new_framerate, TRACK_VIDEO); diff --git a/cinelerra-5.1/cinelerra/ydiff.C b/cinelerra-5.1/cinelerra/ydiff.C index 369b199c..8fc5470d 100644 --- a/cinelerra-5.1/cinelerra/ydiff.C +++ b/cinelerra-5.1/cinelerra/ydiff.C @@ -113,6 +113,7 @@ gtk_window::gtk_window(int width, int height) gtk_window::~gtk_window() { + gdk_flush(); gtk_widget_destroy(window); g_object_unref(pbuf0); g_object_unref(img0); diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index da5aadec..41b522ff 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -294,12 +294,12 @@ PKG_3RD([twolame],[auto], [ libtwolame ]) PKG_3RD([x264],[auto], - [x264-snapshot-20170416-2245-stable], + [x264-snapshot-20170426-2245], [ libx264.a ], [ . ]) PKG_3RD([x265],[auto], - [x265_2.3], + [x265_2.4], [ libx265.a ], [ . source ]) diff --git a/cinelerra-5.1/ffmpeg/video/h264.f4v b/cinelerra-5.1/ffmpeg/video/h264.f4v index 664351d7..94d66a89 100644 --- a/cinelerra-5.1/ffmpeg/video/h264.f4v +++ b/cinelerra-5.1/ffmpeg/video/h264.f4v @@ -2,4 +2,5 @@ f4v libx264 profile=baseline level=3.0 preset=medium +keyint_min=25 x264opts keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8 diff --git a/cinelerra-5.1/ffmpeg/video/h264.mp4 b/cinelerra-5.1/ffmpeg/video/h264.mp4 index c4daad77..64b05ba0 100644 --- a/cinelerra-5.1/ffmpeg/video/h264.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h264.mp4 @@ -1 +1,4 @@ mp4 libx264 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=25 +x264opts keyint=25 diff --git a/cinelerra-5.1/ffmpeg/video/h265-12bit.mp4 b/cinelerra-5.1/ffmpeg/video/h265-12bit.mp4 index 93c8965c..f52813d9 100644 --- a/cinelerra-5.1/ffmpeg/video/h265-12bit.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h265-12bit.mp4 @@ -5,5 +5,7 @@ colorspace=bt2020_cl color_primaries=bt2020 color_trc=bt2020_12bit pixel_format=yuv422p12 -x265-params=output-depth=12 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=30 +x265-params=output-depth=12:keyint=30 cin_quality=-1 diff --git a/cinelerra-5.1/ffmpeg/video/h265-hi.mp4 b/cinelerra-5.1/ffmpeg/video/h265-hi.mp4 index d73b1a5e..9a452fe2 100644 --- a/cinelerra-5.1/ffmpeg/video/h265-hi.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h265-hi.mp4 @@ -1,3 +1,6 @@ mp4 libx265 crf=5 cin_quality=-1 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=30 +x265-params=keyint=30 diff --git a/cinelerra-5.1/ffmpeg/video/h265-lo.mp4 b/cinelerra-5.1/ffmpeg/video/h265-lo.mp4 index c3d54288..307dfc3d 100644 --- a/cinelerra-5.1/ffmpeg/video/h265-lo.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h265-lo.mp4 @@ -2,3 +2,6 @@ mp4 libx265 # lossy but faster crf=25 cin_quality=-1 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=30 +x265-params=keyint=30 diff --git a/cinelerra-5.1/ffmpeg/video/h265-med.mp4 b/cinelerra-5.1/ffmpeg/video/h265-med.mp4 index 0408dcb1..9f862800 100644 --- a/cinelerra-5.1/ffmpeg/video/h265-med.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h265-med.mp4 @@ -2,3 +2,6 @@ mp4 libx265 # visually lossless crf=18 cin_quality=-1 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=30 +x265-params=keyint=30 diff --git a/cinelerra-5.1/ffmpeg/video/h265.mp4 b/cinelerra-5.1/ffmpeg/video/h265.mp4 index 8174ea34..19ee8e33 100644 --- a/cinelerra-5.1/ffmpeg/video/h265.mp4 +++ b/cinelerra-5.1/ffmpeg/video/h265.mp4 @@ -1,2 +1,5 @@ mp4 libx265 cin_quality=-1 +# use framerate for 1 keyframe/sec, needed for seeks +keyint_min=30 +x265-params=keyint=30 diff --git a/cinelerra-5.1/thirdparty/downloads.txt b/cinelerra-5.1/thirdparty/downloads.txt index bd3e0a89..30e16771 100644 --- a/cinelerra-5.1/thirdparty/downloads.txt +++ b/cinelerra-5.1/thirdparty/downloads.txt @@ -27,7 +27,7 @@ http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 https://sourceforge.net/projects/lame/files/latest/download?source=directory = 3.99.5 http://dl.maptools.org/dl/libtiff/libtiff-cvsroot, untar, cd libtiff, cvs init, cd /tmp/x, cvs co -d path/libtiff = 4.0.6 https://sourceforge.net/projects/libuuid/files/latest/download?source=directory - 1.0.3 -ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20170416-2245-stable.tar.bz2 -https://bitbucket.org/multicoreware/x265/downloads/x265_2.3.tar.gz +ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20170426-2245-stable.tar.bz2 +https://bitbucket.org/multicoreware/x265/downloads/x265_2.4.tar.gz http://ffmpeg.org/releases/ffmpeg-3.3.tar.bz2 https://chromium.googlesource.com/webm/libvpx/+archive/0c0a05046db1c0b59a7fcc29785a190fdbbe39c2.tar.gz = 1,6,1 diff --git a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170416-2245-stable.tar.xz b/cinelerra-5.1/thirdparty/src/x264-snapshot-20170416-2245-stable.tar.xz deleted file mode 100644 index 0ddf716e..00000000 Binary files a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170416-2245-stable.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz b/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz new file mode 100644 index 00000000..d5cfdd8e Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/x265_2.3.tar.xz b/cinelerra-5.1/thirdparty/src/x265_2.3.tar.xz deleted file mode 100644 index 98e8a238..00000000 Binary files a/cinelerra-5.1/thirdparty/src/x265_2.3.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/x265_2.4.tar.xz b/cinelerra-5.1/thirdparty/src/x265_2.4.tar.xz new file mode 100644 index 00000000..79f74c0e Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x265_2.4.tar.xz differ