Is mp4 stream able with ffserver?
Asked Answered
L

2

3

Days I trying to stream mp4 file with ffserver.
I read many questions like these:
https://superuser.com/questions/563591/streaming-mp4-with-ffmpeg
Begin stream simple mp4 with ffserver
http://ffmpeg.gusari.org/viewtopic.php?f=12&t=1190
http://ffmpeg.org/pipermail/ffserver-user/2012-July/000204.html
HTML5 - How to stream large .mp4 files?

Finally I cant understand is mp4 stream able or not?
Is it a way to do this with ffserver?
Is there any sample?I read helps but they most about live stream but I just want to stream a simple mp4 file.

Logography answered 17/2, 2015 at 18:9 Comment(0)
B
1

Yes.

Streaming an mp4-file is very much possible with ffserver. However it might require some reading of the documentation:

https://ffmpeg.org/ffmpeg.html

https://ffmpeg.org/ffserver.html

The crucial part is the writing of the configuration file for ffserver (ffserver.conf). As far as I know, ffmpeg provides a list of sample-configurations:

Although they might be a bit outdated but if you try to run them, ffserver will tell you if something isn't as it should be :)

Edit:

(Since I only have a rep of 1, I can't post more than 2 links I removed the samples and displayed a rather simple one below)

To stream an mp4-file you may have to consider that ffserver might have problems to stream in the mp4-format. Still you can stream a mp4-file but in a different Format.

A very simple way would be like this:

<Stream streamTest.asf>    #ASF as the streaming Format
File "/tmp/video1.mp4"     #or wherever you store your Videos
</Stream>

The server converts the file on it's own, but if you really want to stream in mp4 you may have to take a closer look at "fragmented mp4".

To watch the stream use a player that can handle asf (I used VLC) and watch from URL:

ip-address:port/streamTest.asf

Summary:

It should say that I am also still learning the ways of ffserver, so there might be some mistakes :)

This is a short summary of the chapters from the ffserver-documentation to get started.

5.2 Global options

The options in this chapter specify your server settings. For example how many simultaneous requests should be handled. On what port do you want to stream etc... For people who are completely new to ffserver, most of the default-values should be sufficient.

5.3 Feed section

The feed section is one of the core parts of ffserver. Since a feed can serve multiple streams it might be useful to build that first.
Note: Feed is only necessary if you want to
a) live stream
b) stream files that are not stored on your server
c) mess around with the file before streaming

5.4 Stream section

Here you can actually build your own stream. There are a lot of variables that can be changed and I recommend to start slowly with adding/customizing options. From this point on the documentation does a decent job. So now you know, what you need (again, I feel like the possibilities are countless but I'm still a beginner^^) and where to find the basics.

The structure of your ffserver.conf might (but doesn't have to) look like this:

#Options from 5.2
HTTPPort 8090
#...
#Feed (Options from 5.3)
<Feed feed1.ffm>
#...
</Feed>
#
#Stream (Options from 5.4)
<Stream stream1.asf>
Feed feed1.ffm
Format asf
NoAudio
#...
</Stream>

Since this is my first post, I hope it is not too chaotic :)

Bunnie answered 2/11, 2015 at 13:2 Comment(1)
Can you summarise the relevant parts of the linked pages?Bathtub
L
0

ffserver.conf:

HTTPPort 8090
HTTPBindAddress 0.0.0.0
RTSPPort 8091
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -

<Stream 1.mp4>
File "/path/1.mp4"
Format rtp
</Stream>

Start:

ffserver -f ffserver.conf

Play:

ffplay rtsp://localhost:8091/1.mp4
Laris answered 29/10, 2017 at 15:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.