Streaming mp4 with ffmpeg
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.
The article HTML 5 and iPad-friendly Video from your own Web Site, last updated Nov 12, 2014, has this information :
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.