[FFmpeg-user] ffserver mpegts audio/video streams swapped

Sam Gardner lwnexgen at gmail.com
Sun Jul 31 23:35:40 EEST 2016


*How do I control the output stream mapping when using ffserver?*

I'm trying to livestream an mpegts stream using ffserver, but when I use
ffserver the output audio/video streams are swapped.

I've tried using both git-head, and the 2.8.7 tag of the ffmpeg sources,
and both have the same behavior.

If I use the "example" ffserver.conf file that's shipped in the sources
using the same input, I get the same mapping issue with the same sources
(0:0 is the audio, 0:1 is video).

*Logs*
/home/sam/bin/ffmpeg-287 -i - http://127.0.0.1:8090/tuner0.ffm
ffmpeg version 2.8.7 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-7)
  configuration: --prefix=/home/sam/ffmpeg_build
--extra-cflags=-I/home/sam/ffmpeg_build/include
--extra-ldflags=-L/home/sam/ffmpeg_build/lib --bindir=/home/sam/bin
--pkg-config-flags=--static --enable-gpl --enable-nonfree
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpeg2video @ 0x3f2d9a0] Invalid frame dimensions 0x0.
..    Last message repeated 4 times
Input #0, mpegts, from 'pipe:':
  Duration: N/A, start: 62728.280367, bitrate: N/A
  Program 3
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, max. 90000
kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
5.1(side), fltp, 384 kb/s
    Stream #0:2[0x35](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 128 kb/s (visual impaired)
[libopus @ 0x3fc4660] Specified sample rate 22050 is not supported
Output #0, ffm, to 'http://127.0.0.1:8090/tuner0.ffm':
  Metadata:
    creation_time   : 2016-07-31 15:17:52
    Stream #0:0(eng): Audio: opus (libopus), 22050 Hz, 1 channels, s16, 64
kb/s
    Metadata:
      encoder         : Lavc56.60.100 libopus
    Stream #0:1: Video: vp9 (libvpx-vp9), none, 1280x720, q=-1--1, 2000
kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbc
    Metadata:
      encoder         : Lavc56.60.100 libvpx-vp9
*Stream mapping:*
*  Stream #0:1 -> #0:0 (ac3 (native) -> opus (libopus))*
*  Stream #0:0 -> #0:1 (mpeg2video (native) -> vp9 (libvpx-vp9))*
Error while opening encoder for output stream #0:0 - maybe incorrect
parameters such as bit_rate, rate, width or height

*ffserver.conf*
BindAddress 127.0.0.1

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 10000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog ffserver.log

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed tuner0.ffm>
File /tmp/tuner0.ffm
FileMaxSize 1G
</Feed>

<Stream tuner0.webm>
Feed tuner0.ffm
Format webm

# Video settings
VideoCodec libvpx-vp9
VideoSize 1280x720
VideoFrameRate 29.97
AVOptionVideo flags +global_header
AVOptionVideo speed 6
AVOptionVideo tile-columns 4
AVOptionVideo frame-parallel 1
AVOptionVideo threads 8
AVOptionVideo static-thresh 0
AVOptionVideo max-intra-rate 300
AVOptionVideo deadline realtime
AVOptionVideo lag-in-frames 0
AVOptionVideo error-resilient 1
AVOptionAudio flags +global_header
PreRoll 1
StartSendOnKey
VideoBitRate 2000

# Audio settings
# defaults
</Stream>

# Server status
<Stream stat.html>
Format status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Stream>

If I don't use ffserver, I can encode the same source to a local webm file
with the same encoding settings without issue:
*Working Encode:*
/home/sam/bin/ffmpeg-287 -i - -speed 6 -tile-columns 4 -frame-parallel 1
-threads 8 -static-thresh 0 -max-intra-rate 300 -deadline realtime
-lag-in-frames 0 -error-resilient 1 /var/www/html/tuner0.webm
ffmpeg version 2.8.7 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-7)
  configuration: --prefix=/home/sam/ffmpeg_build
--extra-cflags=-I/home/sam/ffmpeg_build/include
--extra-ldflags=-L/home/sam/ffmpeg_build/lib --bindir=/home/sam/bin
--pkg-config-flags=--static --enable-gpl --enable-nonfree
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpeg2video @ 0x38b1c80] Invalid frame dimensions 0x0.
...    Last message repeated 6 times
Input #0, mpegts, from 'pipe:':
  Duration: N/A, start: 63562.744367, bitrate: N/A
  Program 3
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, max. 90000
kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
5.1(side), fltp, 384 kb/s
    Stream #0:2[0x35](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 128 kb/s (visual impaired)
[libvpx-vp9 @ 0x3e537c0] v1.6.0
[libopus @ 0x38b77e0] No bit rate set. Defaulting to 320000 bps.
Output #0, webm, to '/var/www/html/tuner0.webm':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 1920x1080 [SAR 1:1 DAR
16:9], q=-1--1, 200 kb/s, 29.97 fps, 1k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.60.100 libvpx-vp9
    Stream #0:1(eng): Audio: opus (libopus), 48000 Hz, 5.1, flt, 320 kb/s
    Metadata:
      encoder         : Lavc56.60.100 libopus
*Stream mapping:*
*  Stream #0:0 -> #0:0 (mpeg2video (native) -> vp9 (libvpx-vp9))*
*  Stream #0:1 -> #0:1 (ac3 (native) -> opus (libopus))*


More information about the ffmpeg-user mailing list