I want to stream a real-time video flux that come from udp into a HTML video tag. I made some research but I got a lot of informations and I struggle to have a clear overview of what I can do and what I can't.

The video flux use H.264 and AAC codecs, MP4 container and has a 3840x2160 (4K) resolution. I'd like to play it on Chrome (latest version).

As I understand from now, HTML video tag can natively read H.264/AAC videos. I made it work with the video direclty on my server (I'm using Meteor JS + React).

I learnt to use FFmpeg to stream an udp flux read by VLC player, and then I used FFserver (I know it's deprecated) to create an HTTP flux also read by VLC but not by the HTML video tag.

So... my question is : is HTML video can natively read video stream from HTTP ?

I've seen a lot of discussions about HLS and DASH, but I didn't understand if (and why) they're mandatory.

I read a post about someone creating a HLS m3u8 using only FFmpeg, is it a viable solution ?

FFserver configuration

HTTPPort                        8090
HTTPBindAddress                 0.0.0.0
MaxHTTPConnections              20
MaxClients                      10
MaxBandwidth                    100000

<Feed feed.ffm>
  File                          /tmp/feed.ffm
  FileMaxSize                   1g
  ACL allow                     127.0.0.1
</Feed>

<Stream stream.mpeg>
  Feed                          feed.ffm
  Format                        mpeg
  AudioCodec                    aac
  AudioBitRate                  256
  AudioChannels                 1
  VideoCodec                    libx264
  VideoBitRate                  10000      // Total random here
  VideoBitRateRange             5000-15000 // And here...
  VideoFrameRate                30
  VideoQMin                     1
  VideoQMax                     50
  VideoSize                     3840x2160
  VideoBufferSize               20000      // Not sure either
  AVOptionVideo                 flags +global_header
</Stream>

I had to specify QMin and QMax to avoid error message but I don't really understand what is it.

FFmpeg command line

ffmpeg -re -i bbb_sunflower_2160p_30fps_normal.mp4 -strict -2 -r 30 -vcodec libx264 http://localhost:8090/feed.ffm

This work with VLC. I'm working with a file on my computer before moving to an udp stream.

up vote 1 down vote accepted

Media support on browsers is a constantly changing landscape so it is worth having some places to look for the latest view.

The table at this link is generally up to date in my experience:

You'll notice that the table includes the codec and the container - e.g. h.264 in mp4. This is important to understand as a codec may be supported by your browser but not in the container you want.

For the containers and codecs supported, the HTML5 tag will support HTTP streams or more accurately HTTP downloads. Most severs and browsers will support downloading the video file in chunks so that you can start viewing before the video is fully downloaded.

For better performance across different device types and different network conditions, video is often delivered via an Adjustable Bit Rate (ABR) protocol such as HLS or DASH. ABR also allows the client device or player download the video in chunks, e.g 10 second chunks, but the server provides each chunk in multiple different bit rate versions. The player can select the next chunk from the bit rate most appropriate to the current network conditions. See some more info in this answer also:

  • So if I can't read my video from my HTTP FFserver, it's probably just my configuration and not some technical limitation ? – c.censier Sep 26 at 11:41
  • Well, it could be a format or codec/container support issue - if you have a test stream you can share it should be easy to check quickly? – Mick Sep 26 at 12:00
  • I've updated my post to show you FFserver configuration and FFmepg command line. I originaly tried this with mp4 container but there were issues (I don't remember exactly which ones) so I switched to mpeg. Thank for the help by the way ! – c.censier Sep 26 at 12:29
  • Actually, if all you want is an easy way to stream your bbb_sunflower_2160p_30fps_normal.mp4 video to a browser or a mobile device, you can just serve it as a static file with most web servers. For example with nodes: expressjs.com/en/starter/static-files.html. This is quick and works for any format the browser supports. – Mick Sep 26 at 13:25
  • Using a mp4 file is just a step, the final goal is to display a video flux coming via udp (not necessarily compliant in terms of codecs). Browsers cannot directly display an udp flux, so I have to transcode into a HTTP flux. – c.censier Sep 26 at 13:36

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.