[FFmpeg-trac] #1819(undetermined:new): Wrong number of channels reported for HE-AAC stream in MP4
FFmpeg
trac at avcodec.org
Mon Oct 15 16:54:45 CEST 2012
#1819: Wrong number of channels reported for HE-AAC stream in MP4
-------------------------------------+-------------------------------------
Reporter: mbradshaw | Owner:
Type: defect | Status: new
Priority: normal | Component:
Version: git- | undetermined
master | Keywords:
Blocked By: | Blocking:
Reproduced by developer: 0 | Analyzed by developer: 0
-------------------------------------+-------------------------------------
'''Summary of the bug:'''
I have an MP4 file containing H264 video and an HE-AAC stream. I'm quite
positive the HE-AAC stream is stereo, but in some cases gets reported as
mono by FFmpeg. The dump info from FFmpeg shows it as stereo, but ffprobe
-show_streams shows it as mono. However, if I remux it to a plain .aac
file, ffprobe-show_streams then shows it as stereo. See the below command
lines.
I noticed this problem when using the C API. After opening the MP4 and
calling `avformat_find_stream_info()`, the HE-AAC stream->codec
(AVCodecContext) had a reported channels of 2 and channel_layout of 3
(stereo). However, once I opened the codec to decode (by calling
`avcodec_open2()`), stream->codec's attributes changed and now channels
was 1 and channel_layout was 4 (mono). Original discussion can be seen at
http://ffmpeg.org/pipermail/libav-user/2012-October/002857.html
QuickTime and Windows Media Player both say the file is mono when
inspecting the file, but I don't believe they are correct. MediaInfo shows
the file as stereo.
Logs:
'''ffprobe -show_treams on the MP4:''' (note the dump shows stereo, but
the [STREAM] shows 1 channel)
{{{
./ffprobe -show_streams -select_streams 0 ~/MP4-Apple264-AACPlus.mp4
ffprobe version N-45341-g3632f35 Copyright (c) 2007-2012 the FFmpeg
developers
built on Oct 11 2012 16:10:23 with gcc 4.2.1 (GCC) (Apple Inc. build
5666) (dot 3)
configuration: --enable-libopenjpeg --enable-libx264 --enable-gpl
libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 32.100 / 54. 32.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Users/mjbshaw/MP4-Apple264-AACPlus.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2012-01-16 21:01:41
encoder : Sorenson Squeeze
Duration: 00:00:11.19, start: 0.000000, bitrate: 789 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz,
stereo, s16, 32 kb/s
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : soun
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
480x360, 765 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47952 tbc
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : vide
Stream #0:2(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : sdsm
Stream #0:3(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : odsm
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=unknown
codec_type=audio
codec_time_base=1/22050
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=s16
sample_rate=44100
channels=1
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=493568
duration=11.192018
bit_rate=32000
nb_frames=241
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:creation_time=2012-01-16 21:01:41
TAG:language=und
TAG:handler_name=soun
[/STREAM]
}}}
'''ffprobe -show_frames:''' (every frame has 2 channels)
{{{
$ ./ffprobe -show_frames -select_streams 0 ~/MP4-Apple264-AACPlus.mp4
ffprobe version N-45341-g3632f35 Copyright (c) 2007-2012 the FFmpeg
developers
built on Oct 11 2012 16:10:23 with gcc 4.2.1 (GCC) (Apple Inc. build
5666) (dot 3)
configuration: --enable-libopenjpeg --enable-libx264 --enable-gpl
libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 32.100 / 54. 32.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Users/mjbshaw/MP4-Apple264-AACPlus.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2012-01-16 21:01:41
encoder : Sorenson Squeeze
Duration: 00:00:11.19, start: 0.000000, bitrate: 789 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz,
stereo, s16, 32 kb/s
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : soun
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
480x360, 765 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47952 tbc
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : vide
Stream #0:2(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : sdsm
Stream #0:3(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : odsm
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
[FRAME]
media_type=audio
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
pkt_duration=2048
pkt_duration_time=0.046440
pkt_pos=6211
sample_fmt=s16
nb_samples=2048
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=2048
pkt_pts_time=0.046440
pkt_dts=2048
pkt_dts_time=0.046440
pkt_duration=2048
pkt_duration_time=0.046440
pkt_pos=24505
sample_fmt=s16
nb_samples=2048
channels=2
channel_layout=stereo
[/FRAME]
[...and so on; every frame has channels=2...]
}}}
'''Remuxing the HE-AAC stream to plain .aac:'''
{{{
$ ./ffmpeg -i ~/MP4-Apple264-AACPlus.mp4 -acodec copy -vn ~/out.aac
ffmpeg version N-45342-g6efe1ed Copyright (c) 2000-2012 the FFmpeg
developers
built on Oct 13 2012 10:34:47 with gcc 4.2.1 (GCC) (Apple Inc. build
5666) (dot 3)
configuration: --enable-libopenjpeg --enable-libx264 --enable-gpl
libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 32.100 / 54. 32.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Users/mjbshaw/MP4-Apple264-AACPlus.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2012-01-16 21:01:41
encoder : Sorenson Squeeze
Duration: 00:00:11.19, start: 0.000000, bitrate: 789 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
s16, 32 kb/s
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : soun
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
480x360, 765 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47952 tbc
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : vide
Stream #0:2(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : sdsm
Stream #0:3(und): Data: none (mp4s / 0x7334706D)
Metadata:
creation_time : 2012-01-16 21:01:57
handler_name : odsm
File '/Users/mjbshaw/out.aac' already exists. Overwrite ? [y/N] y
Output #0, adts, to '/Users/mjbshaw/out.aac':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf54.32.100
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 32
kb/s
Metadata:
creation_time : 2012-01-16 21:01:41
handler_name : soun
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 45kB time=00:00:11.19 bitrate= 33.2kbits/s
video:0kB audio:44kB subtitle:0 global headers:0kB muxing overhead
3.768232%
}}}
'''ffprobe -show_streams on the remuxed out.aac:''' (note the [STREAMS]
now shows 2 channels)
{{{
$ ./ffprobe -show_streams ~/out.aac
ffprobe version N-45342-g6efe1ed Copyright (c) 2007-2012 the FFmpeg
developers
built on Oct 13 2012 10:34:47 with gcc 4.2.1 (GCC) (Apple Inc. build
5666) (dot 3)
configuration: --enable-libopenjpeg --enable-libx264 --enable-gpl
libavutil 51. 74.100 / 51. 74.100
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 32.100 / 54. 32.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
[aac @ 0x10180ec00] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x10180ec00] Estimating duration from bitrate, this may be
inaccurate
Input #0, aac, from '/Users/mjbshaw/out.aac':
Duration: 00:00:11.78, bitrate: 31 kb/s
Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 31 kb/s
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16
sample_rate=44100
channels=2
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/28224000
start_pts=N/A
start_time=N/A
duration_ts=332743089
duration=11.789367
bit_rate=31524
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]
}}}
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1819>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list