0

Context:
I have long video files (600+ hours) that I want to split on resolution change & keep the high-res parts. I have extracted all the timestamps to a file with ffprobe so now all that's left is to split the video.

The actual issue:
My FFMPEG commands have over 20k splits resulting in 300k character commands which bash complains about with 'argument list too long'
ffmpeg -i input.mkv -map 0 -c copy -segment_times 1799.68,1818.78,...,3283103.479 -reset_timestamps 1 -f segment output_%03d.mkv

Notes:

  • This command avoids re-encoding, making it significantly faster than other methods.
  • I need to maintain the ability to calculate the timestamp a clip came from.
1
  • have you looked at the docs for "preset files"? You might be able to put some of this into a preset file which would reduce the command line.
    – Yorik
    Commented 2 days ago

1 Answer 1

0

You'll have to perform this task in stages. Instead of creating all segments in one command, do it piecemeal.

Let's say you have 15 segment split points s1..s15.

ffmpeg -copyts -i input.mkv -map 0 -c copy -segment_times s1,s2,s3 -to s4 -segment_start_number 0 -reset_timestamps 0 -f segment out_%03d.mkv

ffmpeg -copyts -ss s4 -i input.mkv -map 0 -c copy -segment_times s5,s6,s7 -to s8 -segment_start_number 4 -reset_timestamps 0 -f segment out_%03d.mkv

ffmpeg -copyts -ss s8 -i input.mkv -map 0 -c copy -segment_times s9,s10,s11 -to s12 -segment_start_number 8 -reset_timestamps 0 -f segment out_%03d.mkv

ffmpeg -copyts -ss s12 -i input.mkv -map 0 -c copy -segment_times s13,s14,s15 -segment_start_number 12 -reset_timestamps 0 -f segment out_%03d.mkv

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .