Important point is -ss is before input file. If you place after input file And remote video. create thumbnail will very slow.
local video
$ ffmpeg -ss 5.3 -i "/home/ubuntu/video.mpg" -vframes 1 -f image2 "/home/ubuntu/thumbnail.jpg"
remote video
$ ffmpeg -ss 5.3 -i "http://example.com/video.mpg" -vframes 1 -f image2 "/home/ubuntu/thumbnail.jpg"
Ruby on Rails example
hr = %x[ffmpeg -loglevel error -ss #{m[:time_of]} -i \"#{input_file}\" -y -vframes 1 -vf scale='min(#{size}\\, iw):-1' -f image2 \"#{output_file}\" 2>&1]
- -loglevel error: when error show message.
- -ss: time offset. need before input file
- -i: input file
- -y: force overwrite output file
- -vframe: Set the number of video frames to output. This is an alias for -frames:v
- -vf scale='min(#{size}\\, iw):-1': set thumbnail output size.
- -f image2: For extracting images from a video
- "output_file": thumbnail output file
- 2>&1: return error message
沒有留言:
張貼留言