简体   繁体   English

在 FFMPEG 中裁剪和转换时创建缩略图文件

[英]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.但是,在 input.mov 之后,它会破坏脚本的其余部分。 Bit of a noob to FFMpeg. 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.创建缩略图并创建 output.mp4,但未裁剪或使用缩略图。 I'm assuming the thumbnail creation needs to go in that same sequence?我假设缩略图的创建需要按照相同的顺序进行?

If the 10th frame is fine, then you can use如果第10帧没问题,那么你可以使用

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如果您知道中途持续时间,例如trim=st=12.5 ,那么您的修剪参数可以是trim=st=12.5

(If you're on a shell where [] are special characters, use single quotes for mapping) (如果您在 [] 是特殊字符的外壳上,请使用单引号进行映射)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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