[FFmpeg-user] spliting L & R audio channel from mpegts to different streams issue with ffserver

Pavel Svoboda svobodap at rferl.org
Wed Sep 11 14:51:06 CEST 2013


Hello 

 

I apologize for newbie question.

 

Please let me ask You for help with audio channel mapping. 

 

I have mpegts stream with stereo and I need to split the audio channels to
different outputs L>feed1 R>feed2 but I am still failing.

 

Locally everythings works correctly but passing to ffserver still hear both
channels.

 

Please do you have advice or any clue?

 

Regards

 

Pavel

 

 

This works: 

ffmpeg -i udp://@234.1.1.222:1234 -map_channel 0.0.0 -acodec libmp3lame -ab
32k -ac 1 -f rtp rtp://127.0.0.1:1234

ffmpeg -i udp://@234.1.1.222:1234 -map_channel 0.0.1 -acodec libmp3lame -ab
32k -ac 1 -f rtp rtp://127.0.0.1:1234

 

But this doesn't work and both channels are still inside

ffmpeg -re -i udp://@234.1.1.223:1234 -map_channel 0.0.0 -acodec libmp3lame
-ab 32k -ac 1 http://127.0.0.1:8090/feed1.ffm

ffmpeg -re -i udp://@234.1.1.223:1234 -map_channel 0.0.1 -acodec libmp3lame
-ab 32k -ac 1 http://127.0.0.1:8090/feed2.ffm

 

working:

# ffmpeg -re -i udp://@234.1.1.223:1234 -v verbose -loglevel debug
-map_channel 0.0.0 -acodec libmp3lame -ab 32k -ac 1 -f rtp
rtp://127.0.0.1:1234

ffmpeg version git-2013-09-10-7883827 Copyright (c) 2000-2013 the FFmpeg
developers

  built on Sep 10 2013 09:49:23 with gcc 4.4.7 (GCC) 20120313 (Red Hat
4.4.7-3)

  configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin
--extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac
--enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libfreetype --enable-libspeex --enable-libtheora

  libavutil      52. 43.100 / 52. 43.100

  libavcodec     55. 31.101 / 55. 31.101

  libavformat    55. 16.102 / 55. 16.102

  libavdevice    55.  3.100 / 55.  3.100

  libavfilter     3. 84.100 /  3. 84.100

  libswscale      2.  5.100 /  2.  5.100

  libswresample   0. 17.103 /  0. 17.103

  libpostproc    52.  3.100 / 52.  3.100

Splitting the commandline.

Reading option '-re' ... matched as option 're' (read input at native frame
rate) with argument '1'.

Reading option '-i' ... matched as input file with argument
'udp://@234.1.1.223:1234'.

Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'verbose'.

Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.

Reading option '-map_channel' ... matched as option 'map_channel' (map an
audio channel from one stream to another) with argument '0.0.0'.

Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'libmp3lame'.

Reading option '-ab' ... matched as AVOption 'ab' with argument '32k'.

Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '1'.

Reading option '-f' ... matched as option 'f' (force format) with argument
'rtp'.

Reading option 'rtp://127.0.0.1:1234' ... matched as output file.

Finished splitting the commandline.

Parsing a group of options: global .

Applying option v (set logging level) with argument verbose.

Successfully parsed a group of options.

Parsing a group of options: input file udp://@234.1.1.223:1234.

Applying option re (read input at native frame rate) with argument 1.

Successfully parsed a group of options.

Opening an input file: udp://@234.1.1.223:1234.

[mpegts @ 0x269eaa0] Format mpegts probed with size=2048 and score=100

[mpegts @ 0x269eaa0] stream=0 stream_type=4 pid=c3c prog_reg_desc=

[mpegts @ 0x269eaa0] File position before avformat_find_stream_info() is 0

[mpegts @ 0x269eaa0] first_dts 7594706935 not matching first dts 7594715575
in the queue

[mpegts @ 0x330faa0] first_dts 7601523895 not matching first dts 7601973175
in the queue

    Last message repeated 2 times

[mpegts @ 0x330faa0] max_analyze_duration 5000000 reached at 5016000
microseconds

[mpegts @ 0x330faa0] File position after avformat_find_stream_info() is
156792

Input #0, mpegts, from 'udp://@234.1.1.223:1234':

  Duration: N/A, start: 84461.376611, bitrate: 128 kb/s

  Program 1

    Metadata:

      service_name    : Web

      service_provider:

    Stream #0:0[0xc3c], 211, 1/90000: Audio: mp2 ([4][0][0][0] / 0x0004),
48000 Hz, stereo, s16p, 128 kb/s

Successfully opened the file.

Parsing a group of options: output file rtp://127.0.0.1:1234.

Applying option map_channel (map an audio channel from one stream to
another) with argument 0.0.0.

Applying option acodec (force audio codec ('copy' to copy stream)) with
argument libmp3lame.

Applying option ac (set number of audio channels) with argument 1.

Applying option f (force format) with argument rtp.

Successfully parsed a group of options.

Opening an output file: rtp://127.0.0.1:1234.

Successfully opened the file.

detected 4 logical cores

[graph 0 input from stream 0:0 @ 0x3321280] Setting 'time_base' to value
'1/48000'

[graph 0 input from stream 0:0 @ 0x3321280] Setting 'sample_rate' to value
'48000'

[graph 0 input from stream 0:0 @ 0x3321280] Setting 'sample_fmt' to value
's16p'

[graph 0 input from stream 0:0 @ 0x3321280] Setting 'channel_layout' to
value '0x3'

[graph 0 input from stream 0:0 @ 0x3321280] tb:1/48000 samplefmt:s16p
samplerate:48000 chlayout:0x3

-map_channel is forwarded to lavfi similarly to -af pan=0x4:c0=c0.

[pan @ 0x3321ae0] This syntax is deprecated. Use '|' to separate the list
items.

[pan @ 0x3321ae0] compat: called with args=[0x4|c0=c0]

[pan @ 0x3321ae0] Setting 'args' to value '0x4|c0=c0'

[audio format for output stream 0:0 @ 0x333cc00] Setting 'sample_fmts' to
value 's32p|fltp|s16p'

[audio format for output stream 0:0 @ 0x333cc00] Setting 'sample_rates' to
value '44100|48000|32000|22050|24000|16000|11025|12000|8000'

[audio format for output stream 0:0 @ 0x333cc00] Setting 'channel_layouts'
to value '0x4'

[AVFilterGraph @ 0x3300760] query_formats: 5 queried, 12 merged, 0 already
done, 0 delayed

[pan @ 0x3321ae0] o0 = 1 i0 + 0 i1

[pan @ 0x3321ae0] Pure channel mapping detected: 0

Output #0, rtp, to 'rtp://127.0.0.1:1234':

  Metadata:

    encoder         : Lavf55.16.102

    Stream #0:0, 0, 1/90000: Audio: mp3 (libmp3lame), 48000 Hz, mono, s16p,
32 kb/s

Stream mapping:

  Stream #0:0 -> #0:0 (mp2 -> libmp3lame)

SDP:

v=0

o=- 0 0 IN IP4 127.0.0.1

s=No Name

c=IN IP4 127.0.0.1

t=0 0

a=tool:libavformat 55.16.102

m=audio 1234 RTP/AVP 14

b=AS:32

 

Press [q] to stop, [?] for help

[libmp3lame @ 0x333e640] Trying to remove 47 more samples than there are in
the queue

size=       9kB time=00:00:02.32 bitrate=  30.1kbits/s

video:0kB audio:9kB subtitle:0 global headers:0kB muxing overhead -6.845238%

 

 

not working

# ffmpeg -re -i udp://@234.1.1.223:1234 -v verbose -loglevel debug
-map_channel 0.0.0 -acodec libmp3lame -ab 32k -ac 1
http://127.0.0.1:8090/feed1.ffm

ffmpeg version git-2013-09-10-7883827 Copyright (c) 2000-2013 the FFmpeg
developers

  built on Sep 10 2013 09:49:23 with gcc 4.4.7 (GCC) 20120313 (Red Hat
4.4.7-3)

  configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin
--extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac
--enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libfreetype --enable-libspeex --enable-libtheora

  libavutil      52. 43.100 / 52. 43.100

  libavcodec     55. 31.101 / 55. 31.101

  libavformat    55. 16.102 / 55. 16.102

  libavdevice    55.  3.100 / 55.  3.100

  libavfilter     3. 84.100 /  3. 84.100

  libswscale      2.  5.100 /  2.  5.100

  libswresample   0. 17.103 /  0. 17.103

  libpostproc    52.  3.100 / 52.  3.100

Splitting the commandline.

Reading option '-re' ... matched as option 're' (read input at native frame
rate) with argument '1'.

Reading option '-i' ... matched as input file with argument
'udp://@234.1.1.223:1234'.

Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'verbose'.

Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.

Reading option '-map_channel' ... matched as option 'map_channel' (map an
audio channel from one stream to another) with argument '0.0.0'.

Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'libmp3lame'.

Reading option '-ab' ... matched as AVOption 'ab' with argument '32k'.

Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '1'.

Reading option 'http://127.0.0.1:8090/feed1.ffm' ... matched as output file.

Finished splitting the commandline.

Parsing a group of options: global .

Applying option v (set logging level) with argument verbose.

Successfully parsed a group of options.

Parsing a group of options: input file udp://@234.1.1.223:1234.

Applying option re (read input at native frame rate) with argument 1.

Successfully parsed a group of options.

Opening an input file: udp://@234.1.1.223:1234.

[mpegts @ 0x3b48a80] Format mpegts probed with size=2048 and score=100

[mpegts @ 0x3b48a80] stream=0 stream_type=4 pid=c3c prog_reg_desc=

[mpegts @ 0x3b48a80] File position before avformat_find_stream_info() is 0

[mpegts @ 0x3b48a80] first_dts 7529958775 not matching first dts 7529967415
in the queue

    Last message repeated 2 times

[mpegts @ 0x3b48a80] first_dts 7529958775 not matching first dts 7529976055
in the queue

    Last message repeated 2 times

[mpegts @ 0x3b48a80] first_dts 7529958775 not matching first dts 7529984695
in the queue

    Last message repeated 2 times

[mpegts @ 0x3e0ca80] File position after avformat_find_stream_info() is
158484

Input #0, mpegts, from 'udp://@234.1.1.223:1234':

  Duration: N/A, start: 83768.448611, bitrate: 128 kb/s

  Program 1

    Metadata:

      service_name    : Web

      service_provider:

    Stream #0:0[0xc3c], 211, 1/90000: Audio: mp2 ([4][0][0][0] / 0x0004),
48000 Hz, stereo, s16p, 128 kb/s

Successfully opened the file.

Parsing a group of options: output file http://127.0.0.1:8090/feed1.ffm.

Applying option map_channel (map an audio channel from one stream to
another) with argument 0.0.0.

Applying option acodec (force audio codec ('copy' to copy stream)) with
argument libmp3lame.

Applying option ac (set number of audio channels) with argument 1.

Successfully parsed a group of options.

Opening an output file: http://127.0.0.1:8090/feed1.ffm.

[ffm @ 0x3e3b5e0] Format ffm probed with size=2048 and score=101

[AVIOContext @ 0x3e6c9c0] Statistics: 4096 bytes read, 0 seeks

Successfully opened the file.

detected 4 logical cores

[graph 0 input from stream 0:0 @ 0x3e22300] Setting 'time_base' to value
'1/48000'

[graph 0 input from stream 0:0 @ 0x3e22300] Setting 'sample_rate' to value
'48000'

[graph 0 input from stream 0:0 @ 0x3e22300] Setting 'sample_fmt' to value
's16p'

[graph 0 input from stream 0:0 @ 0x3e22300] Setting 'channel_layout' to
value '0x3'

[graph 0 input from stream 0:0 @ 0x3e22300] tb:1/48000 samplefmt:s16p
samplerate:48000 chlayout:0x3

[audio format for output stream 0:0 @ 0x3e20c80] Setting 'sample_fmts' to
value 's16'

[audio format for output stream 0:0 @ 0x3e20c80] Setting 'sample_rates' to
value '44100'

[audio format for output stream 0:0 @ 0x3e20c80] Setting 'channel_layouts'
to value '0x4'

[audio format for output stream 0:0 @ 0x3e20c80] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:0'

[AVFilterGraph @ 0x3dfd760] query_formats: 4 queried, 6 merged, 3 already
done, 0 delayed

0.500000 0.500000

[auto-inserted resampler 0 @ 0x3df7820] ch:2 chl:stereo fmt:s16p r:48000Hz
-> ch:1 chl:mono fmt:s16 r:44100Hz

Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':

  Metadata:

    creation_time   : now

    encoder         : Lavf55.16.102

    Stream #0:0, 0, 1/1000000: Audio: mp2, 44100 Hz, mono, s16, 32 kb/s

Stream mapping:

  Stream #0:0 -> #0:0 (mp2 -> mp2)

Press [q] to stop, [?] for help

size=      16kB time=00:00:01.84 bitrate=  71.1kbits/s

video:0kB audio:7kB subtitle:0 global headers:0kB muxing overhead
120.868159%



More information about the ffmpeg-user mailing list