简体   繁体   English

如何将.h264流保存到图像? C ++

[英]How to save a .h264 stream to an image? C++

ALREADY WORKING: I get video from embedded video source (just device) through LAN and I can get video from it and save it to file ".h264" (append to file every next "encodedPacket", C++) (it is worked fine, I can play file using VLC). 已经工作:我可以通过LAN从嵌入式视频源(只是设备)中获取视频,并且可以从中获取视频并将其保存到文件“ .h264”(每隔一个“ encodedPacket”,C ++追加到文件中)(工作正常,我可以使用VLC播放文件)。

TASK: How can I save image files periodically (5 in 1 second for example) (any format, but I want jpg)? 任务:如何定期保存图像文件(例如1秒内5张)(任何格式,但我需要jpg)?

File info: 文件信息:

Video Format : AVC Format/Info : Advanced Video Codec Format profile : Baseline@L3.1 Format settings : 1 Ref Frames Format settings, CABAC : No Format settings, RefFrames : 1 frame Width : 640 pixels Height : 480 pixels Display aspect ratio : 4:3 Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive 视频格式:AVC格式/信息:高级视频编解码器格式配置文件:Baseline@L3.1格式设置:1参考帧格式设置,CABAC:无格式设置,RefFrames:1帧宽度:640像素高度:480像素显示纵横比: 4:3色彩空间:YUV色度二次采样:4:2:0位深度:8位扫描类型:逐行

ffmpeg is your friend: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video ffmpeg是您的朋友: https : //trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

I'd try something like: ffmpeg -i input.h264 -vf fps=5 out%d.jpg 我会尝试类似的东西:ffmpeg -i input.h264 -vf fps = 5 out%d.jpg

If your input is a network stream you can do something like ffmpeg -i tcp://local_hostname:port?listen 如果您输入的是网络流,则可以执行以下操作:ffmpeg -i tcp:// local_hostname:port?listen

https://trac.ffmpeg.org/wiki/StreamingGuide https://trac.ffmpeg.org/wiki/StreamingGuide

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

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