Opened 11 years ago

Closed 11 years ago

#3180 closed defect (fixed)

flv demuxer does not decode the aac audio properly

Reported by: Benjamin Larsson Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: flv aac
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

./ffmpeg -i rtmpt_stream2.flv 
ffmpeg version N-58535-g58010e5 Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 28 2013 21:28:49 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      52. 55.100 / 52. 55.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Input #0, flv, from 'rtmpt_stream2.flv':
  Metadata:
    Encoder         : Omnia A/XE
    StreamTitle     : 
    StreamUrl       : 
  Duration: 00:00:11.87, start: 0.000000, bitrate: 35 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, mono, fltp, 32 kb/s
At least one output file must be specified

FFmpeg identifies the channels by parsing the aac extra data which indicates that the file is a mono stream.


./ffmpeg -i rtmpt_stream2.flv out.wav
ffmpeg version N-58535-g58010e5 Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 28 2013 21:28:49 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      52. 55.100 / 52. 55.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Input #0, flv, from 'rtmpt_stream2.flv':
  Metadata:
    Encoder         : Omnia A/XE
    StreamTitle     : 
    StreamUrl       : 
  Duration: 00:00:11.87, start: 0.000000, bitrate: 35 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, mono, fltp, 32 kb/s
File 'out.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'out.wav':
  Metadata:
    StreamUrl       : 
    StreamTitle     : 
    ISFT            : Lavf55.21.102
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
[aac @ 0x1f8b440] Parametric Stereo signaled to be not-present but was found in the bitstream.
    Last message repeated 248 times
size=    1036kB time=00:00:11.91 bitrate= 712.3kbits/s    
video:0kB audio:1036kB subtitle:0 global headers:0kB muxing overhead 0.007541%

Decoding it shows that the aac stream contains parametric stereo.

The onMetaData indicates that this stream actually contains a stereo stream.

File onMetaData block
DEBUG: Property: <Name: duration, NUMBER: 0.00>
DEBUG: Property: <Name: audiodatarate, NUMBER: 32.00>
DEBUG: Property: <Name: audiosamplerate, NUMBER: 44100.00>
DEBUG: Property: <Name: audiosamplesize, NUMBER: 16.00>
DEBUG: Property: <Name: stereo, BOOLEAN: TRUE>
DEBUG: Property: <Name: audiocodecid, NUMBER: 10.00>
DEBUG: Property: <Name: Encoder, STRING: Omnia A/XE>
DEBUG: Property: <Name: StreamTitle, STRING: >
DEBUG: Property: <Name: StreamUrl, STRING: >

So the suggestion is to change the demuxer to replace the aac extra data with a valid version. The replace condition should be based on codec, data rate and stereo flag.

Attachments (1)

rtmpt_stream2.flv (51.5 KB ) - added by Benjamin Larsson 11 years ago.

Download all attachments as: .zip

Change History (4)

by Benjamin Larsson, 11 years ago

Attachment: rtmpt_stream2.flv added

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Description: modified (diff)
Keywords: flv aac added
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

comment:2 by Benjamin Larsson, 11 years ago

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 0fb9b96..2f29408 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -125,8 +125,8 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const
uint8_t *buf,
                 c->ext_object_type = get_object_type(&gb);
                 if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1)
                     c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
-                if (get_bits_left(&gb) > 11 && get_bits(&gb, 11) == 0x548)
-                    c->ps = get_bits1(&gb);
+//                if (get_bits_left(&gb) > 11 && get_bits(&gb, 11) == 0x548)
+//                    c->ps = get_bits1(&gb);
                 break;
             } else
                 get_bits1(&gb); // skip 1 bit

This patch makes the file decode properly.

Version 1, edited 11 years ago by Carl Eugen Hoyos (previous) (next) (diff)

comment:3 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed by Benjamin Larsson since 419787a2

Note: See TracTickets for help on using tickets.