[FFmpeg-user] Live stream with ffmpeg and ffserver won't work unless using default parameters.

Steve (IWWD) steve at iwwd.com
Wed Oct 25 16:00:45 EEST 2017


Hi All,

I have a live stream that's being received (as an input) with the following
parameters:

Input #0, mpegts, from 'http://10.0.0.1/hdmi':
  Duration: N/A, start: 53055.748056, bitrate: N/A
  Program 1 
    Stream #0:0[0x44]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p,
720x480, 25 fps, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x45]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
stereo, fltp, 137 kb/s


I'm currently using FFServer with the following settings:

<Feed livestream.ffm>
  File /tmp/livestream.ffm
  FileMaxSize 50M
  ACL allow localhost
</Feed>

<Stream livestream>
	Feed livestream.ffm
	Format webm

	# Video Settings
	VideoFrameRate 25
	VideoSize 720x480
	AVOptionVideo flags +global_header

	# Audio settings
	AudioCodec libvorbis
	AudioSampleRate 48000
	AVOptionAudio flags +global_header

	StartSendOnKey

</Stream>


And I'm calling 'ffmpeg' with the following command:

ffmpeg -i http://10.0.0.1/hdmi -c:v libvpx -an -b:v 512K -b:a 128K -cpu-used
4 -threads 8 -s 720x480 http://localhost:8090/livestream.ffm



The problem I'm having is that if I change virtually any setting at all, the
stream won't work anymore.  

I'm wanting to have ffmpeg re-encode the stream to a max video bandwidth of
512K and audio bandwidth of 128k in stereo, but if I change these
parameters, it won't work.

Say I add in ffserver the parameter 'AudioBitRate 128' and 'AudioChannels 2'


ffserver then complains with:

Wed Oct 25 23:56:23 2017 127.0.0.1 - - [GET] "/livestream.ffm HTTP/1.1" 200
4175
Wed Oct 25 23:56:23 2017 [NULL @ 0x1c00ec0]Failed to read extradata of size
4261
Wed Oct 25 23:56:23 2017 127.0.0.1 - - [POST] "/livestream.ffm HTTP/1.1" 200
4096


And ffmepg dies with:

Input #0, mpegts, from 'http://10.0.4.7/hdmi':
  Duration: N/A, start: 53640.811844, bitrate: N/A
  Program 1 
    Stream #0:0[0x44]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p,
720x480, 25 fps, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x45]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
stereo, fltp, 117 kb/s
[tcp @ 0x19547c0] Connection to tcp://localhost:8090 failed (Connection
refused), trying next address
[tcp @ 0x199abe0] Connection to tcp://localhost:8090 failed (Connection
refused), trying next address
[libvpx @ 0x199a160] v1.3.0
Output #0, ffm, to 'http://localhost:8090/livestream.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf56.25.101
    Stream #0:0: Audio: vorbis (libvorbis), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc56.26.100 libvorbis
    Stream #0:1: Video: vp8 (libvpx), yuv420p, 720x480, q=-1--1, 64 kb/s, 25
fps, 1000k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.26.100 libvpx
Stream mapping:
  Stream #0:1 -> #0:0 (aac (native) -> vorbis (libvorbis))
  Stream #0:0 -> #0:1 (h264 (native) -> vp8 (libvpx))
Could not write header for output file #0 (incorrect codec parameters ?):
Connection reset by peer


What am I missing here?  I seem to be able to read the stream properly, but
somewhere between ffmpeg and ffserver it's getting lost in translation.

Can anyone help out here?  What am I missing?

Thanks
Steve.







More information about the ffmpeg-user mailing list