avconv保存10帧并循环更新 [英] avconv save 10 frames and update them in cycle

查看:140
本文介绍了avconv保存10帧并循环更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  avconv -f video4linux2 -i / dev / video0 -r 5 output_%04d.png 

似乎要正常工作...但是我需要保存只有10帧和覆盖保存首先保存所有的时间...任何方式这样做?我需要能够保存框架并在其他应用程序中处理它们,但进程可能需要比记录更长的时间。



尝试保存一帧并覆盖它,但是问题是文件被使用,它根本不起作用。

解决方案

有一个迂回的方式来做到这一点。您可以使用段复用器。不过,这不支持图像序列。所以,该方法是使用PNG编解码器在MOV文件中进行编码,然后运行一个脚本来将PNG流无损地提取到图像格式。

  ffmpeg -f video4linux2 -i / dev / video0 -r 5 -c:v png 
-f段-segment_time 0.1 -segment_wrap 10 out%d.mov

然后,重复以下所有10个MOV的命令,

  ffmpeg -i out1.mov -c copy out1.png 


The way I am saving frames from camera is:

avconv -f video4linux2 -i /dev/video0 -r 5 output_%04d.png

Seems to be working fine... but... I need to save only 10 frames and overwrite the saved first saved all the time... any way to do that? I need to be able to save frames and process them in other application... but process may take longer than record.

Tried to save one frame and overwrite it, but the problem is that file is being used and it simply doesn't work.

解决方案

There's a roundabout way to do this. You can use the segment muxer. This doesn't support image sequences, though. So, the method is to encode using PNG codec in MOV files and then run a script to extract the PNG stream losslessly to the image format.

ffmpeg -f video4linux2 -i /dev/video0 -r 5 -c:v png
       -f segment -segment_time 0.1 -segment_wrap 10 out%d.mov

And then, iterate the command below for all 10 MOVs,

ffmpeg -i out1.mov -c copy out1.png

这篇关于avconv保存10帧并循环更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆