I need to stream webm video to browser from my video server.
The video server (C++) receives vp8 encoded frame packets of webcam or screen from the client with .ivf headers like <4_bytes_data_size><8_bytes_pts><vp8_encoded_data>. Also I send 4 bytes of total packet duration before the rest of data, so the server knows the presentation timestamp, size and duration of each frame.
The question is: which headers should I use for frames in order for the browser to be able to play the stream in the <video> tag. Maybe there is some standard for webm real time streaming implementing?
PS: AFAIK the webm consists of EBML markup. If the same is used in <video> tag to parse the stream, could someone explain me what are the minimal set of EBML elements for video playback (no audio, just video)?
Video tag does not support ivf. Minimum webm requirement is whatever the minimum is to package your stream.
Related
I have live audio and video data that I can either send as an Ogg or Matroska (WebM) stream. I also have dynamic metadata that will be sent from the server to the client, and should be correlated with the A/V streams. For example, the exact server time when the audio packet was recorded.
I attempted to hack this with Kate encoding, but that appears to send all the subtitle data at once in the beginning, and not dynamically as it happens. If you could tell me how to send well-correlated dynamic subtitle data, then that's a viable solution as well.
I am currently trying to implement an algorithm which can quickly discard unwanted frames from an MP4 video when encoding to another MP4 (using Media Foundation).
The encoding part doesn't seem to bad - the "Source Reader plus Sink Writer" approach is nice and fast. You basically just have to create an IMFSourceReader and an IMFSinkWriter, set the source native media type on the writer, yada, yada, yada, and just loop: source.ReadSample(&sample) --> writer.WriteSample(&sample). The WriteSample() calls can be conditioned on whether they're "! 2 b discarded".
That naive approach is no good if you consider that the samples read will be "predicted-frames", a.k.a., P-frames in the H.264 encoded streams. Dropping any preceding "intra-coded picture frame" (I-frame or key-frame) before that will result in garbled video.
So, my question is, is it possible to introduce an I-frame (somehow) into the sink writer before resuming the sample writing in the sink writer?
Doing something with the MFSampleExtension_CleanPoint attribute doesn't seem to help. I could manually create an IMFSample (via MFCreateSample), but getting it in the right H.264 format might be tricky.
Any ideas? Or thoughts on other approaches to dropping frames during encoding?
I think that this is not possible without reenconding the video! The Reference between P and I Frames are in the h264 Bitstream and not in the container (MP4). You can only safely skip frames, which are not referenced from other frames:
last P-Frames of a GOP (before the next I-Frame)
B-Frames
Normaly these Frames are not referrenced, but they can be! This dependes on the encoder-settings used to create the h264 stream
I have written an application which triggers an IP Camera to stream it's data (MPEG4) over RTP. This works fine so far - I start to setup and start the stream with the corresponding RTSP commands ( DESCRIBE, SETUP and PLAY ).
While streaming I receive the usual Sender Reports and send my own Receiver Reports - Everything is working fine here.
Now with the application mentioned above, I do NOT read the stream. I have a seperate hardware , which just logs all the stuff going over the Ethernet ( a little bit like Wireshark ). Now when the whole streaming is finished I can download those logs from my hardware and extract data from them.
So what I have then is a logfile with all the data from the RTP stream as raw data.
My question would now is: How do I write this appropriately into a MPEG4 file? I know this is a very broad question and I don't expect to get a step-by-step tutorial. But actually I am a bit overwhelmed and don't know where to start.If I just memcpy all the Payload from the RTP messages sequentially into a MPEG4 file it doesn't work. Now I am also a bit confused by SDP and stuff.
Well maybe someone has a link or some help for me..?
You should first read RFC3016, which describes the RTP format of MPEG-4 stream, then you'll know how to extract MPEG-4 frames from the RTP stream.
I actually changed from MPEG4 to H.264 - it actually was a little bit easier to write a video file like this. For H.264 this answer covers it pretty much:
How to process raw UDP packets so that they can be decoded by a decoder filter in a directshow source filter
I have a question on streaming output of libx264. My scenario is that Iam capturing video from webcam, encoding with x264 and then streaming data to flash, muxed as FLV. For muxing, Im using output/flv_bitstream.h, included in libx264 budle. The only modification of muxer, that I made, is that instead of fwrite() im usig send() to transfer data via socket... Encoding library is working fine. If I save output (even muxed), vlc player is able to play it. But, when it goes to data transfer via socket, vlc and flash are not cooperating. The weird thig is, that if Im sending data to vlc player thru socket, it waits till transmission end and then plays video from buffer. But what I need is to play live stream.
I also tryed to read flv file and send it to vlc of flash tag by tag and it is working fine.
Any suggestions?
Implement a simple http server and respond to incoming requests with:
"HTTP/1.0 200 OK\r\n"
"Pragma: no-cache\r\n"
"Content-Type: video/x-flv\r\n"
"\r\n"
Each of these should be followed by the raw FLV bit-stream.
This should enable live consumption of the content using eg. VLC, flowplayer, ...
Also, consider using 'url_open_dyn_buf'/'url_close_dyn_buf' rather than 'fwrite', see ffserver for reference.
Nadav at Sophin
I deal with rtp packets of gtalk video. I want to make video using gtalk rtp payload data. According to my search gtalk use h264 codec for video.
I combined all of rtp payload which is send with gtalk video and wanted to play ffplay using this comment "ffplay -f h264 "filename" but I can't see
anything and I take this error "Could not find codec parameters (Video: h264, yuv420p)". I think my wrong is combining rtp payload. how can I play this payload?
Thanks for your helps.
Cheers.
It could be that you need the sequence and picture parameters sets (SPS and PPS) which are often transferred during session setup. Standard protocols used for this are RTSP and SIP though I have no clue whether gtalk uses either of these.