[FFmpeg-user] he_aac with latm framing in a TS

Chris Wass chris.wass at gmail.com
Tue Nov 13 09:46:58 CET 2012


On 12 November 2012 20:45, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Chris Wass <chris.wass <at> gmail.com> writes:
>
> > I have compiled ffmpeg with the necessary FDK_AAC library to enable
> he_aac
> > with latm but cannot figure out the directive to make it happen:
> >
> > $ ffmpeg -y -i <infile> -vcodec libx264 -vprofile main -vlevel 3 -vf
> > scale=720:576 -acodec libfdk_aac -aprofile aac_he -ar 48000 out.ts
> >
> > the above results in adts framing,  How do I ensure latm framing?
>
> The fine output of ffmpeg -h full suggests using -latm
> Did you try that?
>
> Please do not top-post here, Carl Eugen
>
>
Ok, getting the hang of this.  Thanks for your patience.

This starts to look more promising.   First trying to create an (audio
only) TS file...

$ ffmpeg -y -i catswiththumbs_1080_short.mp4 -vn -acodec libfdk_aac -latm 1
-aprofile aac_he -ar 48000 audio.ts
ffmpeg version git-2012-11-11-5aedee4 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Nov 11 2012 22:12:29 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-x11grab
--enable-libx264 --enable-nonfree --enable-version3
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'catswiththumbs_1080_short.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2011-03-06 19:21:07
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4070 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 3938 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
s16, 127 kb/s
    Metadata:
      creation_time   : 2011-03-06 19:21:07
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
Output #0, mpegts, to 'audio.ts':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf54.36.100
    Stream #0:0(und): Audio: aac (HE-AAC), 48000 Hz, stereo, s16, 69 kb/s
    Metadata:
      creation_time   : 2011-03-06 19:21:07
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> libfdk_aac)
Press [q] to stop, [?] for help
[mpegts @ 0x9724be0] AAC bitstream not in ADTS format and extradata missing
av_interleaved_write_frame(): Invalid data found when processing input


The thought then is that we are generating latm framed audio but ffmpeg
cannot output a ts file using it,   as a work around we could use ffmpeg to
create a raw latm PES stream and use another muxing tool to generate a TS
(I would rather it worked using ffmpeg alone but if this is not a likely
option...).

$ ffmpeg -y -i catswiththumbs_1080_short.mp4 -vn -acodec libfdk_aac -latm 1
-aprofile aac_he -ar 48000 audio.latm
ffmpeg version git-2012-11-11-5aedee4 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Nov 11 2012 22:12:29 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-x11grab
--enable-libx264 --enable-nonfree --enable-version3
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'catswiththumbs_1080_short.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2011-03-06 19:21:07
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4070 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 3938 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
s16, 127 kb/s
    Metadata:
      creation_time   : 2011-03-06 19:21:07
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
Output #0, latm, to 'audio.latm':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf54.36.100
    Stream #0:0(und): Audio: aac (HE-AAC), 48000 Hz, stereo, s16, 69 kb/s
    Metadata:
      creation_time   : 2011-03-06 19:21:07
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> libfdk_aac)
Press [q] to stop, [?] for help
Segmentation fault

Hmmm.   I don't want to go too far down this backup route that so far
results in a Seg fault if ffmpeg is actually capable of creating a TS file
directly from an latm audio stream.   Any thoughts?


More information about the ffmpeg-user mailing list