I want to stream videos via ffserver. My videos are in container formats like mkv and avi and sometimes have multiple audio/video tracks. How can I tell ffserver which track to use? It seems to always take the first one.


If you look at this page they show this technique of using ffmpeg to do the slicing and then having it forward it to the ffserver:

$ ffmpeg \
    -f v4l2 -s 320x240 -r 25 -i /dev/video0 \
    -f alsa -ac 1 -i hw:0 \

The above command is doing the following:

  • The first part -f v4l2 -s 320x240 -r 25 -i /dev/video0 represents the first input for ffmpeg and captures our webcam video. For more info, you can read more about How to capture a webcam input.
  • The second part -f alsa -ac 1 -i hw:0 represents the second input for ffmpeg and captures our audio, depending on our system audio configuration. For more info, you can read more about Capturing audio with FFmpeg and ALSA.
  • The last, but not the least important, part http://localhost:8090/feed1.ffm represents the feed URL, which tells ffmpeg to connect to ffserver and send it the audio + video streams for broadcast. In this example we used the hostname localhost which means that everything is running on our computer, but if you need to feed the live online ffserver, you'll need to change the localhost to the real host name or IP address of your ffserver computer. Also make sure that your feed name ends with .ffm and if it's not the case, then add -f ffm before your feed URL, to manually specify the output format (because ffmpeg won't be able to figure it out automatically any more), like this -f ffm http://localhost:8090/blah.bleh.

As soon as you type the command above, you should see ffmpeg displaying some statistics about your input streams and counting output frames, which is a pretty good sign that everything works (so far).

  • thanks that would be a work around which I could use. The downside is that I would have a running process for every possible video file. I hoped there would be a simple option for the stream setting inside the ffserver.conf. – Schakal_No1 Jun 17 '13 at 18:24
  • Yeah I didn't see a way to do that. – slm Jun 17 '13 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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