[FFmpeg-user] Find the correct video cut point based on time into the file?

Bo Berglund bo.berglund at gmail.com
Tue May 23 22:41:13 EEST 2023

On Sun, 21 May 2023 10:33:47 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:

For completeness for future readers of this thread:
I received advice on all of the issues in my post on the VideoHelp forum:

>What I think could be possible is if the stream *download command* itself could
>be modified such that it will produce an output video where the sements all
>start at even seconds, then the video will be OK if I cut it at even seconds
>when editing, right?
>But how should I modify my download command to accomplish this?
>My working download script essentially uses this command to get the stream into
>an mp4 file on the Ubuntu server:
>ffmpeg -hide_banner -referer \"${VIDEOURL}\" -i \"${M3U8URL}\" -vf \
>scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -c:a aac \
>-t 3600 output.mp4
>How can it be modified such that the segments start at integer seconds?
>And then how can I adjust the editing script that cuts the sections I need such 
>that the cuts will be on the segment start times?
>(If the segments are longer than 1 second my cut request could be in the middle
>of such a segment anyway...)

Please read the thread at VideoHelp:

You will find how this was resolved:

1) How to adjust the download command such that the resulting video file runs at
30 fps rather than the uneven speed as default.

2) How to set the keyframes to occur on 1 second time interval.

3) How to adjust the extract part of the concat process to make video clips
starting at the keyframe closest to the cut point.

This all works very well now.

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list