VideoHelp Forum
+ 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
    This has really gotten me baffled after checking everywhere and doing many MANY tests. I have a video approximately 6 minutes that I am using to test. The mediaInfo of them is:
    Image
    [Attachment 56904 - Click to enlarge]


    The Encoded portion (Prefixed by T_) is as close as I know how to make it the same as the copied portion.
    The ffprobe shows Identical Bit structure, starting with an I frame and ending with a P frame with the requisite 30 FPS Pts for each frame'
    Image
    [Attachment 56905 - Click to enlarge]


    The problem is that there is always a glitch at the junction, either at the I frame or just afterward
    C:\Users\Bud\Desktop\T_1_1_xInstagram.mp4
    Successful Cut at Frame 60 ENCODED poretion
    1.833333,B
    1.866667,P
    1.900000,B
    1.933333,B
    1.966667,P

    C:\Users\Bud\Desktop\1_1_xInstagram.mp4
    Successful Cut at Frame 120 COPIED portion
    1.833333,B
    1.866667,P
    1.900000,B
    1.933333,B
    1.966667,P

    The junction shows a 1 frame hesitation with a PTS of 2 frames.
    Image
    [Attachment 56906 - Click to enlarge]


    If anyone knows why and/or how these 2 encoded/cut segemnts from the same video can be joined smoothly, I could really use some help.
    BTW I am using FFMpeg concat to join so they do not need to be re-encoded
    Quote Quote  
  2. What is your commandline?
    Try to add -video_track_timescale 60
    Does the problem persist?

    Also, you may want to mutliplex into a .ts container rather than something else.
    Quote Quote  
  3. Could you post the ffprobe commandline you are using to generate the frame txt ?
    I'm doing some cut/join tests with avidemux.
    Quote Quote  
  4. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    ButterW... That Is a command file I use to drag and drop videos to get that in a neat presentation. It is large so I don't know if you want me to post it or i fit will work on your computer (windows 7, 8, 10?)

    Update:
    If you wish to try the following creates 2 files. An Excel CSV file and a text file with the data shown in my previous post:

    Code:
    setlocal enabledelayedexpansion
    @echo off
    chcp 1252
    ::For %%a in (*.mp4,*.mpg,*.flv) Do (
    for /d %%a in ("C:\Users\Bud\Desktop\xInstagram.mp4") Do (
    set /a count=0
    cd %%~dpa
    @echo off > "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\ffprobe.csv"
    
    @echo off > "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\AllFrames.txt"
    @echo off > "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\keys.txt"
    echo frame, media_type, stream_index, key_frame, pkt_pts, pkt_pts_time, pkt_dts, pkt_dts_time,best_effort_timestamp,^
    ver > nul
    Set /a Number=0
    ffprobe.exe -v quiet -i "C:\Users\Bud\Desktop\xInstagram.mp4" -select_streams v:0 -print_format csv -show_entries frame >> "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\ffprobe.csv"
    For /F "tokens=4, 6, 18, 19, 20 delims=, " %%b In ('findstr "video" "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\ffprobe.csv"') do (
    set "x=%%b"
    Set "y=%%c"
    set "z=%%d"
    Set "w=%%e"
    set "v=%%f"
    Set "u=%%g"
    Set "key=!x:~0,1!"
    Set count = !v!
    If !key! == 1 echo !count!    !y:~0,13!    !x:~0,1! >> "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\keys.txt"
    set sort=!x:~0,-7!
    :: If !sort!Then GEQ 0 if !sort! LEQ 10 echo !count!    !y:~0,13!    !x!    !w:~0,1! >> "AllFrames.txt"
    echo !count!    !y:~0,13!    !x!    !w:~0,1! >> "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\AllFrames.txt"
    Set /a count+=1
     set /a ekko=count%%100
     if !ekko! EQU 0 echo Frame !count! processed
    )
    )
    Last edited by Budman1; 22nd Jan 2021 at 23:43.
    Quote Quote  
  5. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Sharc... Ready for this? LOL

    Command line was:
    Code:
    ffmpeg -i "C:\Users\Bud\Desktop\xInstagram.mp4" -ss 0.000000 -vframes 60 -c:v libx264 -b:v 873k -crf 20 -r 30 -c:a aac -ar 44100 -ab 64.0k -x264-params cabac=1:refs=4:deblock=1:0:0:analyse=0x1:0x111:me=hex:subme=6:psy=0:mixed-refs=1:me-range=16:chroma-me=1:trellis=1:8x8dct=0:cqpfile=0:deadzone=21,11:fast-pskip=1:chromaoffset=0:threads=8:lookahead-threads=1:sliced-threads=0:nr=0:decimate=1:interlaced=0:bluray-compat=0:constrained-intra=0:bframes=3:b-pyramid=0:b-adapt=1:b-bias=0:directpred=1:weightb=1:open-gop=0:weightp=1:keyint=60:min-keyint=31:scenecut=40:intra-refresh=0:rc-lookahead=30:rc=crf:mbtree=1:crf=23.0:qcomp=0.60:qpmin=0:qpmax=69:qpstep=4:vbv-maxrate=1968:vbv-bufsize=3937:crf-max=0.0:nal-hrd=none:filler=0:ip-ratio=1.40:aq-mode=2:crf=20.0 -refs 4 -y "C:\Users\Bud\Desktop\0_0_xInstagram.mp4"
    This creates a video that is as close to the original format As i can get.

    I tried your suggestion as this:
    Code:
    ffmpeg -i "C:\Users\Bud\Desktop\xInstagram.mp4" -ss 0.000000 -vframes 60 -c:v libx264 -b:v 873k -crf 20 -r 30 -c:a aac -ar 44100 -ab 64.0k -video_track_timescale 60 -x264-params cabac=1:refs=4:deblock=1:0:0:analyse=0x1:0x111:me=hex:subme=6:psy=0:mixed-refs=1:me-range=16:chroma-me=1:trellis=1:8x8dct=0:cqpfile=0:deadzone=21,11:fast-pskip=1:chromaoffset=0:threads=8:lookahead-threads=1:sliced-threads=0:nr=0:decimate=1:interlaced=0:bluray-compat=0:constrained-intra=0:bframes=3:b-pyramid=0:b-adapt=1:b-bias=0:directpred=1:weightb=1:open-gop=0:weightp=1:keyint=60:min-keyint=31:scenecut=40:intra-refresh=0:rc-lookahead=30:rc=crf:mbtree=1:crf=23.0:qcomp=0.60:qpmin=0:qpmax=69:qpstep=4:vbv-maxrate=1968:vbv-bufsize=3937:crf-max=0.0:nal-hrd=none:filler=0:ip-ratio=1.40:aq-mode=2:crf=20.0 -refs 4 -y "C:\Users\Bud\Desktop\T3_0_xInstagram.mp4"
    I actually do convert them to xxx.TS before muxing to prevent unnecessary encoding:
    Code:
    ffmpeg -i "video1" -c copy -bsf:v h264_mp4toannexb -f mpegts -y "intermediate1.ts"
    ffmpeg -i "video2" -c copy -bsf:v h264_mp4toannexb -f mpegts -y "intermediate2.ts"
    Joining them still gives an error but is almost imperceptible when viewing.
    58 2.005333 0 B
    59 2.038667 0 P
    60 2.038667 1 I

    61 2.072000 0 B
    62 2.105333 0 B

    Closer but not quite a cigar.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!