VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    There is probably an easy answer for this but it eludes me. I have a video with cabac/ 5 ref format and cutting and merging works well and maintains this format. My problem is when I try to encode a portion so I can merge it with a section that has been codec copied, now matter what I try, I get the same High@L3.1 / 4 ref format.

    I am using this script:

    Code:
    ffmpeg -i "D:\Replay Media Catcher\Compilation Zeroed.mp4" -ss 26.293196 -vframes 823 -c:v libx264 -b:v 397k -r 29.97 -c:a aac -ar 44100 -ab 144k -x264-params refs=5:me=hex:subme=8:psy=1:mixed-refss=1:me-range=16:chroma-me=1:trellis=2:8x8dct=1:cqpfile=0:fast-pskip=1:chromaoffset=-2:lookahead-threads=1:sliced-threads=0:nr=0:interlaced=0:bluray-compat=0:constrained-intra=0:bframes=3:b-pyramid=2:b-adapt=1:b-bias=0:directpred=3:weightb=1:open-gop=0:weightp=2:keyint=90:min-keyint=46:scenecut=0:intra-refsresh=0:rc-lookahead=50:mbtree=1:crf=23.0:qcomp=0.60:qpmin=0:qpmax=69:qpstep=4:vbv-maxrate=2000:vbv-bufsize=66:crf-max=27.0:nal-hrd=none:filler=0 -y "D:\Replay Media Catcher\T_0_0_Compilation_Zeroed.mp4"
    What the encoded mediainfo information shows is:

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L3.1
    Format settings : CABAC / 4 Ref Frames
    Format settings, CABAC : Yes
    Format settings, Reference frames : 4 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding

    I just need to know if it is possible to duplicate the original videos format and how if it is.
    Thank you!
    Quote Quote  
  2. Try -x264opts ref=5 instead of -x264-params refs=5
    Quote Quote  
  3. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    As of August 9th, the x264 encoding guide stated:
    Warning: Do not use the option x264opts, as it will eventually be removed. Use x264-params instead.
    Did they leave the old option that works better in ffmpeg?
    Quote Quote  
  4. Originally Posted by Budman1 View Post
    As of August 9th, the x264 encoding guide stated:
    Warning: Do not use the option x264opts, as it will eventually be removed. Use x264-params instead.
    Did they leave the old option that works better in ffmpeg?
    You're right. I haven't seen the new encoding guide yet.
    Quote Quote  
  5. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Okay,solved my problem. It turns out using <-preset slow> will give 5 reference frames automatically and USUALLY matches the x264 parameters in the existing complete video. There are those that have been encoded, transcribed, edited, and merged from who knows what program or multiple programs at different times.

    For these I found if you use the FFMpeg <-Refs x> attribute, libx264 will set the encoded segment to that amount of reference frames. The bad part about doing it this way is that if you end at a reference frame or predicted? frame, FFmpeg will cause a glitch in the output. Case in point:

    End of encoded segment: with B Frames= 3
    No. pts_time type
    233 7.774441 0 P
    234 7.807808 0 B
    235 7.841175 0 B
    236 7.874541 0 B
    237 7.907908 0 P
    238 7.941275 0 B
    239 7.974641 0 P


    Copied segment beginning:
    0 0.000000 1 I
    1 0.033367 0 B
    2 0.066733 0 B
    3 0.100100 0 B
    4 0.133467 0 P
    5 0.166834 0 B
    6 0.200200 0 B
    7 0.233567 0 B
    8 0.266934 0 P

    FFmpeg creates a merged video at the merged point:
    233 7.797464 0 P
    234 7.830831 0 B
    235 7.864198 0 B
    236 7.897564 0 B
    237 7.930931 0 P
    238 7.964298 0 B
    239 7.997664 0 P
    240 8.429012 1 I almost a half second freeze frame

    241 8.462379 0 B
    242 8.495746 0 B
    243 8.529112 0 B
    244 8.562479 0 P

    I'm sure the experts here know this but in case someone else is having trouble cutting the odd video they downloaded, they will at least know why and can experiment for a fix. In this case, removing the incomplete 'B' frame group from the encoded segment ((PBP -> P) before merging fixed my joining problem.

    Long story short for me... stick to Presets whenever possible but understand you may have problems cutting and joining, especially with higher Ref frames numbers. In my case Ref 1/2/3/4 were no problem merging to an encoded segment from the same video. Only Ref 5 and above caused problems with FFProbe, FFPlay and FFMpeg, hence this thread. It's now possible for me to cut accurately within, in my case shown, 2 X 0.033367, 67 thousandths of a second without a noticeable glitch.

    Thanks to everyone that offered a suggestion and if anyone knows of another fix for the Joining problem I listed above, I would love that information.
    Quote Quote  



Similar Threads