[FFmpeg-user] Retain but don't playback frames outside of edit list for transcode

Gyan Doshi ffmpeg at gyani.pro
Wed May 8 07:05:11 EEST 2024



On 2024-05-08 08:55 am, Anne Wu via ffmpeg-user wrote:
> Hi,
> Looking for some guidance on if handling edit-lists this way is
> possible. I recently ran into a situation where I need to transcode
> videos that include edit lists. The edit-list specifies to drop the
> first few frames of the video, and thus the output ends up with fewer
> frames than the original. Is there a way to retain these frames in
> the output, but not have them play during playback? I’m looking for
> the number of frames in the input and output file to be the same.
>
> The original video has 386 frames. This is the transcode command that
> outputs a file with 376 frames: ffmpeg -i ./original.mov -c:v
> libx264 -fps_mode passthrough output.mov
>
> If I use the -ignore_editlist 1 option, it will retain the frames
> outside the edit-list and end up with 386 frames. But it still plays
> back all the frames, which is not the desired behavior:
> ffmpeg -ignore_editlist 1 -i ./original.mov -c:v libx264 -fps_mode
> passthrough output_ignoreEditList.mov

This may work:
Get the timestamp of the first displayed frame.
Then do a transcode of all frames with ignore editlist,
Use the setts bsf on the video stream to offset timestamps so that the 
first displayed frame has a dts of 0.

Regards,
Gyan



More information about the ffmpeg-user mailing list