[FFmpeg-user] Better way to cut parts out of a long video?

Richard Bartczak richard.bartczak at gmx.de
Mon Jun 13 16:31:23 EEST 2022


 From my side of view, to cut videos, the best way will be to use
Avidemux. Avidemux is based on ffmpeg.

You have the GUI the points where to cut. The startpoint does not depend
on key-frames, the endpoint where to cut, it must be a I-frame, easy to
find via up/down cursor, the del-key to cut the video ...

No converting of the video will be necessary (video + audio set to
copy), also you can choose the same container, as of the input file.

If the video is a h.264 or h.265 video (or VP9, AVC1, AV01), it will be
more difficult, because the I-frame of the endpoint to cut, must be also
a IDR-Frame.

For Ubuntu user, s. http://www.avidemux.org/nightly//appimage4Buster to
get an appimage.

Am 13.06.22 um 11:40 schrieb Cecil Westerhof via ffmpeg-user:
> I know that because of iframes you need to put the inputfile before
> the start and to parameters if you want to sure that the start time is
> correctly used. Because of this I defined the following function.
>      function doConvert {
>          echo "Convert $1 to $2"
>          time nice -n 19 ionice -c3  \
>            ffmpeg -y -i $1           \
>              -ss $3 -to $4           \
>              -vcodec libx264 -crf 26 \
>              -acodec libmp3lame      \
>              -qscale:a 9             \
>              -preset veryfast $2
>      }
>
> Normally this is not a problem: I do not have to cut from a video very
> often and mostly the video is not very long. But this weekend I needed
> to cut three parts out of a long video and this took more as 1½ hour
> and my processor was (on my system) completly hogged:
>      doConvert Original/00233-00239.MTS improvisatieVoorEnTegenDeTienGeboden.mkv 2658 2748
>      doConvert Original/00233-00239.MTS improvisatieWelOfNietOntbijten.mkv       2757 2846
>      doConvert Original/00233-00239.MTS improvisatieWatWeetJeOverIjsheiligen.mkv 4620 4682
>
> The time output was (the first one I find a bit strange):
>      real    45m33.66s
>      user    63m9.35s
>      sys     1m0.51s
>      perc    140.83
>
>
>      real    23m18.92s
>      user    60m39.46s
>      sys     0m52.01s
>      perc    263.88
>
>      real    29m36.04s
>      user    88m38.41s
>      sys     1m4.94s
>      perc    303.11
>
> This is because ffmpeg spends all its time seeking the start of the
> video. In the last case that is more as 1¼ hour into the video.
> I am not using ffmpeg that much so maybe I am asking something stupid.
> Would it not be possible to skip to the last iframe before the start?
> Or should I be doing things completly differently?
>


More information about the ffmpeg-user mailing list