Opened 22 months ago

Last modified 22 months ago

#10159 reopened defect

filter trim/concat with single frames not working correctly

Reported by: hoby87 Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: filter trim concat
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by hoby87)

Summary of the bug: using the filters trim and concat, where trim selects single frames and concat should join them, there is an error that only 3 frames are joined, more are omitted. With selecting more than one frame with each trim the problem vanishes. I get the result from the current git master windows build. Also older linux builds (4.4) give this result.
Regardless of the number of trim filter, if they (all) select a single frame, the result is 3 frames in the output. The problem is also present when selecting single and multiple frames with trim.

Edit: I just see, that ffmpeg is dropping the missing frames, as mentioned in the log file, but why? Is my command incorrect?

How to reproduce (first command selects 5x1 frames, resulting in 3 frames in output, second command selects 5x2 frames, resulting in 10 frames):

ffmpeg.exe -report -v 9 -loglevel 99 -i MVI_6289.MOV -filter_complex "[0:v]trim=start=3.72:end=3.76,setpts=PTS-STARTPTS,format=yuvj420p[1v];[0:v]trim=start=4.04:end=4.08,setpts=PTS-STARTPTS,format=yuvj420p[2v];[0:v]trim=start=4.12:end=4.16,setpts=PTS-STARTPTS,format=yuvj420p[3v];[0:v]trim=start=4.24:end=4.28,setpts=PTS-STARTPTS,format=yuvj420p[4v];[0:v]trim=start=4.32:end=4.36,setpts=PTS-STARTPTS,format=yuvj420p[5v];[1v][2v][3v][4v][5v]concat=n=5:v=1[v]" -map "[v]" MVI_6289.out.MOV

ffmpeg.exe -report -v 9 -loglevel 99 -i MVI_6289.MOV -filter_complex "[0:v]trim=start=3.72:end=3.80,setpts=PTS-STARTPTS,format=yuvj420p[1v];[0:v]trim=start=4.04:end=4.12,setpts=PTS-STARTPTS,format=yuvj420p[2v];[0:v]trim=start=4.12:end=4.20,setpts=PTS-STARTPTS,format=yuvj420p[3v];[0:v]trim=start=4.24:end=4.32,setpts=PTS-STARTPTS,format=yuvj420p[4v];[0:v]trim=start=4.32:end=4.40,setpts=PTS-STARTPTS,format=yuvj420p[5v];[1v][2v][3v][4v][5v]concat=n=5:v=1[v]" -map "[v]" MVI_6289.out.MOV

Attachments (2)

5-3.log (89.6 KB ) - added by hoby87 22 months ago.
selecting 5 frames, 3 in output
10-10.log (91.2 KB ) - added by hoby87 22 months ago.
selecting 5x2 frames, 10 in output

Download all attachments as: .zip

Change History (6)

by hoby87, 22 months ago

Attachment: 5-3.log added

selecting 5 frames, 3 in output

by hoby87, 22 months ago

Attachment: 10-10.log added

selecting 5x2 frames, 10 in output

comment:1 by hoby87, 22 months ago

Description: modified (diff)

comment:2 by hoby87, 22 months ago

Resolution: invalid
Status: newclosed

Ok, I solved the problem with setpts=frames_cumsum*9+PTS-STARTPTS, where frames_cumsum is the sum of the previous frames...

comment:3 by hoby87, 22 months ago

Resolution: invalid
Status: closedreopened

Ok, this is more a workaround which seems to fix a bit more complex example, but not the example given here, so I reopen again.

comment:4 by hoby87, 22 months ago

well, my "final" workaround works by setting setpts to PTS-STARTPTS+1000 for each single frame from trim but not for the first. Multiframes get just setpts=PTS-STARTPTS. With this I get an output without dropping or duplicating any frame.

Note: See TracTickets for help on using tickets.