【问题标题】:Save Live Video Stream To Local Storage将实时视频流保存到本地存储
【发布时间】:2011-06-27 19:29:54
【问题描述】:

问题:

I have to save live video streams data which come as an RTP packets from RTSP Server.
The data come in two formats : MPEG4 and h264. 
I do not want to encode/decode input stream.
Just write to a file which is playable with proper codecs. 

有什么建议吗?

最好的祝福

历史:

我的解决方案及其问题:

第一次尝试: FFmpeg

I use FFmpeg libary to get audio and video rtp packets. 
But in order to write packets i have to use av_write_frame : 
which seems that decode /encode takes place.
Also, when i give output format as mp4 ( av_guess_format("mp4", NULL, NULL)
the output file is unplayable. 
[ any way ffmpeg has bad doc. hard to find what is wrong]

第二次尝试:DirectShow

Then i decide to use DirectShow. I found a RTSP Source Filter. 
Then a Mux and File Writer.
Cretae Single graph:

RTSP Source --> MPEG MUX ---> File Writer

It worked but the problem is that  the output file is not playable
if graph is not stoped. If something happens, graph crashed for example
the output file is not playable
Also i can able to write H264 data, but the video is completely unplayable.

【问题讨论】:

    标签: ffmpeg directshow rtsp


    【解决方案1】:

    MP4 文件格式具有正确播放所需的索引,并且只有在完成录制后才能创建索引。因此,任何使用 MP4 容器文件(和其他索引文件)的解决方案都会遇到同样的问题。您需要停止录制以完成文件,否则将无法播放。

    一种可能有帮助的解决方案是将图表分成两部分,这样您就可以在停止当前文件的同时继续录制到新文件。在 www.gdcl.co.uk/gmfbridge 上有一个例子。

    如果您尝试使用 GDCL MP4 多路复用器,但遇到 H264 流问题,请参阅相关问题 GDCL Mpeg-4 Multiplexor Problem

    【讨论】:

    • 谢谢戴维斯。我将检查 GDCL Mpeg-4 多路复用器问题。
    猜你喜欢
    • 2021-06-22
    • 2018-03-06
    • 2015-12-23
    • 2019-03-24
    • 1970-01-01
    • 1970-01-01
    • 2020-05-01
    • 2018-11-05
    • 2016-04-29
    相关资源
    最近更新 更多