0

I am trying to use FFmpeg for splitting a video into multiple supposedly single-scene sub-videos using the scenecut feature and threshold. I found the following command on SE:

ffmpeg -i myVideo.mp4 -y -c:v libx264 -profile:v high -prese6t:v fast -deinterlace -x264opts min-keyint=15:keyint=1000:scenecut=20 -b:v 2000k -c:a aac -b:a 128k -f segment -segment_format mp4 -segment_format_options movflags=empty_moov+frag_keyframe+default_base_moof+skip_trailer+faststart /home/1/output%%05d.mp4

But the following command doesn't work for me and shows error:

Unrecognized option 'prese6t:v'.
Error splitting the argument list: Option not found

Is there any changes since the last FFmpeg? I'm using the latest version.

2

@K7AAY is on the right track. The option label is preset. The output filename mask should be output%05d

But aside from the syntax errors, there are a couple of fundamental issues as well. Fragmented MP4 options are meant for when the segments are packaged within a single container file. The segment muxer emits multiple files so the MP4 muxer fragmentation can be skipped. Also, segment_time should be specified, and with a very low value, else GOPs of size less than the default value (2s) will be combined in some segments.

Command should be

ffmpeg -y -i myVideo.mp4 -vf yadif \
       -c:v libx264 -profile:v high -preset:v fast \
       -x264opts min-keyint=15:keyint=1000:scenecut=20 -b:v 2000k \
       -c:a aac -b:a 128k \
       -f segment -segment_format mp4 -segment_time 0.01 -segment_format_options movflags=faststart \
       /home/1/output%05d.mp4
  • Still I get error: [segment @ 00000210c1e1f040] Could not parse format options list 'faststart' Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- – Tina J Jul 7 '18 at 22:41
  • btw, can I shrink the command? Maybe we can just copy codec -c copy? Most important thing for me is to play around the sensitivity of the scenecut threshold – Tina J Jul 7 '18 at 22:42
  • 1
    Corrected cmd.. – Gyan Jul 8 '18 at 5:00
  • thanks. It works. One question is that now it takes a long time. My eventual goal is just to save an image from each scene, say middle frame of that image, instead of encoding and saving the scene video. Is there a faster way to achieve that? Here is my new question: superuser.com/questions/1337709 – Tina J Jul 9 '18 at 16:06
1

After replacing prese6t:v
with preset:v
because there's no "prese6t" option for ffmpeg

replace output%%05d.mp4
with output5d.mp4

as ffmpeg is rejecting output%%05d.mp4 as an invalid file name.

  • No, the problem is the error. Please look at my updated question. – Tina J Jul 6 '18 at 22:47
  • No, that also didn't work: [mp4 @ 000001adb348a740] Invalid segment filename template 'output%%05d.mp4' Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- – Tina J Jul 6 '18 at 23:35
  • 1
    This is not an answer. This is a comment suggesting help. Utterly nothing wrong doing something like that as a comment but not as an “answer.” – JakeGould Jul 7 '18 at 3:27
  • Corrected, see answer. – K7AAY Jul 8 '18 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.