[FFmpeg-user] What is a bitstream filter?

Arjun Krishnan arjunkc at gmail.com
Wed Dec 5 15:07:36 CET 2012


Hi,

I was trying to wrap raw adts aac data in an mp4 container using

ffmpeg -v verbose -i in.aac -acodec copy out.mp4
ffmpeg version git-2012-08-09-5d8e54f Copyright (c) 2000-2012 the FFmpeg
developers
  built on Nov  6 2012 00:17:05 with gcc 4.5.2 (Ubuntu/Linaro
4.5.2-8ubuntu4)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 67.100 / 51. 67.100
  libavcodec     54. 51.100 / 54. 51.100
  libavformat    54. 22.103 / 54. 22.103
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  7.100 /  3.  7.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[aac @ 0x2bb9260] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x2bb9260] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'in.aac':
  Duration: 00:00:20.17, bitrate: 192 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 192 kb/s
File 'out.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf54.22.103
    Stream #0:0: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 192
kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x2bd10c0] malformated aac bitstream, use -absf aac_adtstoasc
av_interleaved_write_frame(): Operation not permitted

So I can get it to work if
1) Reencode it using -c:a libfaac, but this results in a lower bitrate, for
some reason.
ffmpeg -v verbose -i in.aac -acodec copy -c:a libfaac out.mp4
ffmpeg version git-2012-08-09-5d8e54f Copyright (c) 2000-2012 the FFmpeg
developers
  built on Nov  6 2012 00:17:05 with gcc 4.5.2 (Ubuntu/Linaro
4.5.2-8ubuntu4)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 67.100 / 51. 67.100
  libavcodec     54. 51.100 / 54. 51.100
  libavformat    54. 22.103 / 54. 22.103
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  7.100 /  3.  7.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[aac @ 0x1cba260] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x1cba260] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'in.aac':
  Duration: 00:00:20.17, bitrate: 192 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 192 kb/s
File 'out.mp4' already exists. Overwrite ? [y/N] y
tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf54.22.103
    Stream #0:0: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo,
s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> libfaac)
Press [q] to stop, [?] for help
No more inputs to read from, finishing.e= 128.5kbits/s
size=     317kB time=00:00:20.01 bitrate= 129.6kbits/s
video:0kB audio:313kB subtitle:0 global headers:0kB muxing overhead
1.309636%
2) I pass it through the bitstream filter aac_adtstoasc
ffmpeg -v verbose -i in.aac -bsf aac_adtstoasc -acodec copy out.mp4
ffmpeg version git-2012-08-09-5d8e54f Copyright (c) 2000-2012 the FFmpeg
developers
  built on Nov  6 2012 00:17:05 with gcc 4.5.2 (Ubuntu/Linaro
4.5.2-8ubuntu4)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 67.100 / 51. 67.100
  libavcodec     54. 51.100 / 54. 51.100
  libavformat    54. 22.103 / 54. 22.103
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  7.100 /  3.  7.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[aac @ 0x1a6f260] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x1a6f260] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'in.aac':
  Duration: 00:00:20.17, bitrate: 192 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 192 kb/s
File 'out.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf54.22.103
    Stream #0:0: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 192
kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
No more inputs to read from, finishing.
size=     473kB time=00:00:20.01 bitrate= 193.7kbits/s
video:0kB audio:475kB subtitle:0 global headers:0kB muxing overhead
-0.379035%

In case 2), it works like perfectly. My questions are as follows:
1) Can someone explain what's going on here?
2) What is a bitstream filter? I cannot seem to find any useful information
about.
3) The bitstream filter's name is aac_adtstoasc, so it seems to be
converting from a raw adts aac file to an asc aac file. I can find out what
an adts aac file is, but I cant seem to find any info about asc aac files.
Do you know what this is?

Arjun


More information about the ffmpeg-user mailing list