3

I tested a ffmpeg command to generate thumbnail ffmpeg -y -ss 0 -to 10 -i acb.mp4 -qscale:v 2 -frames:v 1 abc.jpeg on macOS and it worked fine , whereas it gave error for the same command on ubuntu 18.04.2(AWS EC2) for ffmpeg.

error :

Option to (record or transcode stop time) cannot be applied to input url abc.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file abc.mp4.
Error opening input files: Invalid argument

I am using AWS EC2 (ubuntu 18.04.2) , used sudo apt install ffmpeg. Can someone please help me with this , if I have to install it in a different way, or if I am missing something here. Thanks in Advance.

1 Answer 1

6

Remove -to 10

  • You're outputting a single frame so you don't need to declare a duration stop time with -to. A single image has no duration so -to is ignored anyway.
  • -ss (start time offset) with a value of 0 is doing nothing, so you can remove that too.

Example:

    ffmpeg -y -i acb.mp4 -qscale:v 2 -frames:v 1 abc.jpeg

Same as above but gets a screenshot at 30 seconds:

    ffmpeg -y -ss 30 -i acb.mp4 -qscale:v 2 -frames:v 1 abc.jpeg

Get a screenshot at 22 hours 15 minutes 5 seconds but output lower quality:

    ffmpeg -y -ss 22:15:05 -i acb.mp4 -q:v 5 -frames:v 1 abc.jpeg

You can use the alias -q:v instead of -qscale:v if you want.

Why it works in macOS and not Ubuntu

The -to option was previously only an output option. It has been updated to also work as an input file (declared before -i). You are using FFmpeg 3.4.6 which is too old to use -to as an input option. Your FFmpeg version on macOS is new enough that it can use -to as an input option. But as mentioned previously, when outputting a single image -to does nothing and is ignored.

Also see

You must log in to answer this question.

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