Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9091

How can multiple, non-regular segments be extracted from a video using ffmpeg on Windows?

$
0
0

I'm trying to extract some segments from a video (and optionally combine them) using ffmpeg... but I'm not getting very far.

Compared to the various examples I've found here, in the ffmpeg docs and elsewhere, I don't want to extract segments at regular intervals.

Gleaning some info from a number of sources, I think I can do something like:-

ffmpeg -f concat -i seg.txt -c copy out_%03d.mp4

but that doesn't seem to work, owing to a couple of issues...

  • the 'out_%03d.mp4' isn't being expanded into out_001.mp4,out_002.mp4, etc; and
  • there are various issues where the input filespecification is flagged as being 'problematic'; see the entries atthe bottom of the 'seg.txt' file...

The contents of seg.txt:

#file 'e:\tmp\video\kr.mp4' ... file 'KR.mp4'inpoint  75.0outpoint 92.0inpoint  275.0outpoint 300.0inpoint  1049.0outpoint 1082.0# [eof]# errors:#[concat @ 05a6a5c0] Unsafe file name 'E:\tmp\video\kr.mp4'#seg.txt: Operation not permitted#seg.txt: Invalid data found when processing input

Short of doing this, I can certainly do something like:

ffmpeg -i kr.mp4 ^   -c:v libx264 -pix_fmt yuv420p -r 25 -y ^   -preset ultrafast -crf 38 ^      -ss   75.0 -to   92.0 out_001.mp4 ^      -ss  275.0 -to  300.0 out_002.mp4 ^      -ss 1049.0 -to 1082.0 out_003.mp4

...but the actual commands I need to use for each segment include filter clauses, including font files/sizes, etc, as well as other switches... and by the time paths to video files/segments are included, and the cases where I might have 50+ segments to extract from one video, I'm hitting the 8,192 character limit for a command line.

I'm trying to do all this on Windows 8 32-bit, currently using ffmpeg version n6.0-22-g549430e14d-20230529 under Windows' cmd.exe. I can't really use a newer ffmpeg version as I haven't found any newer 32-bit releases.

I'd appreciate any pointers on how to properly invoke ffmpeg to do what I want to do... how to correctly specify the pathed input filename.. and the output file(s) filemask correctly... and how the escaping will need to be done if the ffmpeg commands are placed in a batch file.

Thanks a lot.


Viewing all articles
Browse latest Browse all 9091

Trending Articles