FFmpegInterop: Raw H264 stream: problem with framerate
Hi, I can stream out of a RPi the raw data of an H264 video. If I want to obtain a well-formed MP4 file, I would save the video as H264 and then wrap into an MP4 container:
ffmpeg -r 25 -i raw_video.h264 -vcodec copy wrapped_video.mp4orMP4Box -add raw_video.h264 wrapped_video.mp4It works, but this is of course not possible when streaming.
If I save the raw H264 and play it with CreateFFmpegInteropMSSFromStream, the video is super-fast. I suppose the problem is due to the missing framerate. From the ffmpeg rtsp help I don’t see any useful options to make it work.
Suggestions? TIA
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 42 (21 by maintainers)
Yes, reading and writing data is very complicated. Especially the locked up IBuffer is hard to handle. It should be a one-liner to read and write binary data, from both managed and unmanaged code, as well as creating an IBuffer or InMemoryRandomAccessStream from existing data (without copy!).
@khouzam I have try the way just as FFmegainterop does, return a sample from websocket. and set a mediasource to mediaelement, it works. but if i want use the FFmegainterop, is it possible. I don’t understand what your meaning about to mimic the way we wrap the RandomAccessStream into an IStream interface and wrap the WebSocket inputstream. I try to change the parameter to IIputstream of FFmpegInteropMSS::CreateMediaStreamSource() but i see you cast the RandomAccessStream to Istream. hr = CreateStreamOverRandomAccessStream(reinterpret_cast<IUnknown*>(stream), IID_PPV_ARGS(&fileStreamData));
how can i Cast the IInputstream to a istream?
Here you go, please try the fix on https://github.com/Microsoft/FFmpegInterop/tree/gillesk/fixNoPts.
I haven’t fully tested it yet, that’s why I haven’t created a pull request yet, but it works with your raw file.