简体   繁体   English

如何使用ffmpeg精确快速地从视频中提取多帧

[英]how to extract multi frames from video with ffmpeg exact and fast

i want extract frame from video with ffmpeg 我想用ffmpeg从视频中提取帧

for example 例如

ffmpeg.exe -an -r 21 -ss 00:17:50 -i "K:\\test.mkv" -t 00:00:30 -s 560x314 -q:v 1 "T:\\GIF\\test_%05d.png" ffmpeg.exe -an -r 21 -ss 00:17:50 -i“ K:\\ test.mkv” -t 00:00:30 -s 560x314 -q:v 1“ T:\\ GIF \\ test_%05d。 png”

the command what i intend is 我打算的命令是

extract frame from K:\\test.mkv(O) 从K:\\ test.mkv(O)中提取帧

start at 00:00:30 (O) 从00:00:30(O)开始

extracted image size is 560x314 (o) 提取的图像大小为560x314(o)

output path and file name format T:\\GIF\\test_%05d.png (O) 输出路径和文件名格式T:\\ GIF \\ test_%05d.png(O)

extract 30seconds from start point -t 00:00:30 (X) 从起点-t 00:00:30(X)提取30秒

with frame rate 21(so if video's original fps is 24fps, then it reduced to fps22)(maybe? X) 帧速率为21(因此,如果视频的原始fps为24fps,则降低为fps22)(也许是X)

anyway this is not collect 无论如何这不是收集

i got 660 images, image number is collect but this is not 30seconds video data only 15seconds data. 我得到660张图像,图像编号已收集,但这不是30秒视频数据,只有15秒数据。 this is too large error, so i can't ignore it 这是太大的错误,所以我不能忽略它

i think i can fix it by -ss move to after -i , but this need really a lot of time.. 我想我可以通过-ss移至-i之后来解决它,但这确实需要很多时间。

how can i solve this problem little error is ok but error is too large 我该如何解决这个问题,一点点错误都可以,但错误太大

i just want time x to time y, and capture picture every 1000/22 seconds captured 我只想要时间x到时间y,并每捕获1000/22秒捕获一次图像

Use 采用

ffmpeg -ss 00:17:50 -i "K:\test.mkv"
       -vf trim=duration=30,scale=560:314,setsar=1,setpts=N/22/TB
       -r 22 -q:v 1 "T:\GIF\test_%05d.png"

If your video isn't constant frame rate in the extracted portion, then total no. 如果您的视频在提取的部分中不是恒定的帧频,则总计为No。 of output frames won't be 660. 的输出帧数不会是660。

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

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