简体   繁体   中英

Create thumbnail file when cropping and converting in FFMPEG

I'm currently using the following:

ffmpeg -y -i input.mov -i watermark.png -filter_complex "[0:v]crop=iw-0:ih-440,scale=480:640[bg];[bg][1:v]overlay=W-w-10:H-h-10" output.mp4

To resize, crop and watermark a video, all is working perfectly, however I'd like to grab a screenshot midway through. I've tried adding:

-qscale:v 2 thumbnail.jpg

After the input.mov, however it then ruins the rest of the script. Bit of a noob to FFMpeg.

EDIT:

The following:

ffmpeg -y -i input.mov -vframes 1 -q:v 2 thumbnail.jpg -i watermark.png -filter_complex "[0:v]crop=iw-0:ih-440,scale=480:640[bg];[bg][1:v]overlay=W-w-10:H-h-10" output.mp4

Creates the thumbnail and creates output.mp4, but not cropped or with the thumbnail. I'm assuming the thumbnail creation needs to go in that same sequence?

If the 10th frame is fine, then you can use

ffmpeg -y -i input.mov -i watermark.png -filter_complex "[0:v]crop=iw-0:ih-440,scale=480:640[bg];[bg][1:v]overlay=Ww-10:Hh-10,split=2[v][pic];[pic]trim=start_frame=10[pic]" -map "[v]" -map 0:a? output.mp4 -vframes 1 -map "[pic]" out.jpg

If you know the midway duration, eg 12.5s, then your trim arg can be trim=st=12.5

(If you're on a shell where [] are special characters, use single quotes for mapping)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM