FFmpeg - unable to play stream

6

1

I used the following command to attempt to stream from a file with ffmpeg:

ffmpeg -re -i GunGrave\ -\ 03\ -\ Rain.webm -c copy -f asf rtmp://127.0.0.1:8090/test.asf

This produced the following output:

ffmpeg version N-50515-g28adecf Copyright (c) 2000-2013 the FFmpeg developers   built on Mar  5 2013 22:35:30 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)   
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264   
libavutil      52. 17.103 / 52. 17.103   
libavcodec     54. 92.100 / 54. 92.100   
libavformat    54. 63.103 / 54. 63.103   
libavdevice    54.  3.103 / 54.  3.103   
libavfilter     3. 42.103 /  3. 42.103   
libswscale      2.  2.100 / 2.  2.100   
libswresample   0. 17.102 /  0. 17.102   
libpostproc    52.  2.100 / 52.  2.100 
Input #0, matroska,webm, from 'GunGrave - 03 - Rain.webm':   
  Metadata:
    title           : [AHQ] GunGrave - 19 - Superior   
    Duration: 00:24:20.44, start: 0.000000, bitrate: 259 kb/s
  Stream #0:0: Video: vp8, yuv420p, 768x432, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
  Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)

And here is my ffserver.config file:

Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -

<Feed feed1.ffm>
   File /tmp/feed1.ffm
   FileMaxSize 200K
   ACL allow 127.0.0.1
</Feed>

<Stream test.ts>
   Feed feed1.ffm
   Format mpegts

   AudioCodec libmp3lame
   AudioBitRate 128
   AudioChannels 2
   AudioSampleRate 44100
   AVOptionAudio flags +global_header

   VideoBitRate 800
   VideoFrameRate 25
   VideoSize 640x480
   VideoCodec libx264
   AVOptionVideo flags +global_header
</Stream>

<Stream test.asf>
   Feed feed1.ffm
   Format asf

   AudioCodec mp3
   AudioBitRate 128
   AudioChannels 2
   AudioSampleRate 44100
   AVOptionAudio flags +global_header

   VideoBitRate 800
   VideoFrameRate 25
   VideoSize 640x480
   VideoCodec libx264
   AVOptionVideo flags +global_header
</Stream>

<Stream stat.html>
   Format status

   # Only allow local people to get the status
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
</Stream>

# Redirect index.html to the appropriate site
<Redirect index.html>
   URL http://www.ffmpeg.org/
</Redirect>

When I try to play the stream in windows media player, it fails citing unsupported file type. When I try to play the stream in kmplayer, it simply hangs the program. It refuses to play in a tag in firefox or chrome. I primarily need it to work in HTML5, so this is the major issue for me. I get similar results using ts instead of asf. I'm willing to use whatever file type/codec will work for this.

Fibericon

Posted 2013-03-06T07:18:39.477

Reputation: 204

1I'm not a streaming or ffserver expert but your test.asf configuration talks about MP3 audio and H.264 video, while the FFmpeg output above has Vorbis audio and VP8 video. The video size also isn't correct. With -c copy you're just copying those video and audio bitstreams to the output. – slhck – 2013-03-06T07:31:38.880

So what format would I have to convert the video to in order to make it play? – Fibericon – 2013-03-07T04:06:22.410

Answers

4

You probably copied the FFserver configuration file from somewhere. You can't put any type of video in an ASF stream and it might not work with H.264 video. Also, you're telling FFmpeg to copy the video and audio codecs and forcing the ASF format with the FFserver output instead of just letting FFserver handle everything.

If you want HTML5 streaming, you could switch to WebM video. Also, you can't use RTMP: You will need to stream over HTTP. This blog post should get you started: Streaming live WebM video with FFmpeg.

Here's an example configuration file from that blog—I just replaced vorbis with libvorbis since that produces better quality:

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

   # Audio settings
   AudioCodec libvorbis
   AudioBitRate 64             # Audio bitrate

   # Video settings
   VideoCodec libvpx
   VideoSize 720x576           # 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>

To stream the video, use:

ffmpeg -i GunGrave.webm http://127.0.0.1:8090/test.webm

slhck

Posted 2013-03-06T07:18:39.477

Reputation: 182 472

Amazing, I've been staring at this console for so long. – Fibericon – 2013-03-07T11:31:41.833