W
W
WayMax2016-06-29 16:30:50
Video
WayMax, 2016-06-29 16:30:50

How to setup ffserver for mp4 streaming?

It is necessary to broadcast video from ip-cameras to a web page. Of the available options, it seemed to me the simplest option with a bunch of ffserver and ffmpeg. Perhaps erroneously.
First set up to receive video via html stream in mjpeg format:
File "ffserver.conf"

<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 200M
</Feed>

<Stream feed1.mjpg>
Feed feed1.ffm
Format mpjpeg
NoAudio
</Stream>

Start ffserver
ffserver -d -f /etc/ffserver.conf
Start ffmpeg
ffmpeg -f mjpeg  -i "http://10.1.1.60:80/axis-cgi/mjpg/video.cgi?resolution=640x480" -c copy http://127.0.0.1:8090/feed1.ffm"

The video stream is available at the link " 10.1.1.40:8090/feed1.mjpg " - this option works.
Then I came through to configure video reception via rtsp stream in h264 format:
File "ffserver.conf"
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 200M
</Feed>

<Stream feed1.mp4>
Feed feed1.ffm
Format mp4
NoAudio
</Stream>

Start ffserver
ffserver -d -f /etc/ffserver.conf
Start ffmpeg
ffmpeg -i "rtsp://10.1.1.60:554/axis-media/media.amp?videocodec=h264&resolution=640x480" -acodec copy -vcodec copy "http://127.0.0.1:8090/feed1.ffm"

When trying to access " 10.1.1.40:8090/feed1.mp4 " in the console, ffserver "swears":
Fri Jun 24 02:32:36 2016 10.1.1.41 - - New connection: GET /feed1.mp4
Fri Jun 24 02:32:36 2016 Codec for stream 0 does not use global headers but container format requires global headers
Fri Jun 24 02:32:36 2016 muxer does not support non seekable output
Fri Jun 24 02:32:36 2016 Error writing output header
Fri Jun 24 02:32:36 2016 10.1.1.41 - - [GET] "/feed1.mp4 HTTP/1.1" 200 68

Although if you only run ffmpeg to record the video stream to a file:
ffmpeg -i "rtsp://10.1.1.60:554/axis-media/media.amp?videocodec=h264&resolution=640x480" -acodec copy -vcodec copy "/tmp/test.mp4"

The video stream is correctly saved to a file and played by the video player.
It turns out that the problem is not in the codecs and not in the ffmpeg parameters, but in the "ffserver.conf" file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Trataranaga, 2017-03-15
@Trataranaga

The problem is in the mp4 format, which cannot be streamed.
"muxer does not support non seekable output".
You can use ogg or webm.
Or cut the stream into mp4 pieces and feed them to the player - but that's another story.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question