20

I need to create a feed that has two streams - webm and mp4 - so that it can be compatible on all HTML5 video players. The webm stream works perfectly. However, when trying to access the mp4 stream, the server spits out the following error:

Sat Mar  9 23:21:54 2013 muxer does not support non seekable output

Here's the portion of the ffserver.conf file that deals with the mp4 stream:

<Stream channel1.mp4>       # Output stream URL definition
   Feed feed1.ffm              # Feed from which to receive video
   Format mp4

   # Audio settings
   AudioCodec libmp3lame
   AudioBitRate 64             # Audio bitrate

   # Video settings
   VideoCodec libx264
   VideoSize 560x320           # Video resolution
   VideoFrameRate 25           # Video FPS
   AVOptionVideo flags +global_header  # Parameters passed to encoder
                                       # (same as ffmpeg command-line parameters)
   AVOptionVideo cpu-used 0
   AVOptionVideo qmin 10
   AVOptionVideo qmax 42
   AVOptionVideo quality good
   AVOptionAudio flags +global_header
   PreRoll 15
   StartSendOnKey
   VideoBitRate 400            # Video bitrate
</Stream>

From what I can find, some people are saying that mp4 simply cannot be streamed. I have no attachment to mp4, except for the fact that I was under the impression that you needed mp4 to stream video to the iPhone with an HTML5 video player. If this isn't the case, let me know and I'll gladly switch to something that plays nicer with ffmpeg streaming.

Fibericon
  • 264
  • 2
  • 6
  • 18
  • 6
    You don't really have to *stream* MP4. For HTML5 H.264 / MP4 video it should be enough to encode the video file with `-movflags faststart`, or treat it with `qt-faststart`, then point to the MP4 file in the ` – slhck Mar 10 '13 at 09:14
  • My client is requiring that this be streaming - he wants to disable client seeking completely. It's streaming from a file (the file on the server is in webm format, if it makes a difference). I can't simply hide the controls, because iPhones force controls to be shown. – Fibericon Mar 10 '13 at 09:55
  • @slhck:I am streaming live webcam input with mp4 but unable to do it. It works when I use flv. Is it possible to use mp4 for live streaming? – John Qualis Apr 24 '14 at 14:45
  • @JohnQualis Not sure if it's doable with ffserver. But the container shouldn't matter, really -- the codecs are the same with FLV and MP4 (H.264 and AAC). – slhck Apr 24 '14 at 15:06
  • @sklhck: I got it to work with flv using ffserver but not with mp4. Most web browsers support mp4. I need a something that works on iphone, android and and all famous web browsers and that its h264 :) And I am streaming a webcam live – John Qualis Apr 24 '14 at 15:42
  • Actually I was a little inaccurate in the above comment. Indeed it makes sense that you can't "stream" an MP4 because it contains global metadata in the file header, which makes random stream access impossible. You might want to look into setting up HTTP Live Streaming (which is Apple's own technology), which uses MPEG-2 Transport Streams and transmits the video in segments. – slhck Dec 18 '14 at 06:10
  • You can most certainly stream live to iOS using mpeg-ts/m3u8. I'm not aware of how other servers prevent seeking for live to iOS, but in my red5 plugin I simply remove the older ts files as the stream progresses. The m3u8 is constantly updated with the available segments. – Paul Gregoire Dec 20 '14 at 15:30

2 Answers2

7

The article HTML 5 and iPad-friendly Video from your own Web Site, last updated Nov 12, 2014, has this information :

image

The article recommends using MP4 as a good solution with a recent enough version of ffmpeg, using H.264 encoding with AAC.

I suggest reading the article with attention to the details : It contains an example HTML file that will work on all the major browsers, as well as an example FFmpeg command used to convert videos to .mp4 files so they will stream correctly.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • is this about "live" streaming? – Markus Siebeneicher Dec 07 '15 at 11:58
  • @MarkusSiebeneicher: Yes, mostly. – harrymc Dec 07 '15 at 12:29
  • I still have problems "live" streaming mp4 with ffmpeg, as it seems not "seekable". I pipe the ffmpeg output directly to the browser, with webm it works out of the box. Using mp4 format it kind of says its not seekable... So I really wonder what to do to make mp4 "live" streamable, where no video is saved as file directly (which would make it seekable). – Markus Siebeneicher Dec 07 '15 at 14:08
  • @MarkusSiebeneicher: I suggest asking this question in a new post with details. – harrymc Dec 07 '15 at 14:50
0

I suppose it'll be helpful to think about HTTP Live Streaming.

https://developer.apple.com/streaming/

As I understand it works fine in iOs devices.

Here is one of examples:

https://stackoverflow.com/questions/28723993/ffmpeg-hls-stream-for-android-and-ios