[FFmpeg-user] Preserving AAC LC status when converting to fragmented MP4

Simon Brown simon.k.brown at gmail.com
Fri May 14 16:31:42 EEST 2021


Hi,
I have a mpeg2 transport stream with video as H264 and audio as AAC LC.  If
I use the following command to convert it to fragmented MP4 by just copying
the encoded data, then the result is now AAC, and not AAC LC.  If instead I
re-encode with AAC asking for profile:a aac_low then I get AAC LC.  But if
the input source is AAC LC why would it change the output type to AAC?

ffmpeg.exe -f mpegts -fflags +nobuffer+nofillin -probesize 5000000 -i
soc_udp_rx_02.ts -c:a copy -bsf:a aac_adtstoasc -c:v copy -f mp4
-frag_duration 80000 -movflags +empty_moov+default_base_moof -metadata
title="media source exentions" testaudio.mp4
ffmpeg version git-2020-06-19-2f59946 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma
--enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf
--enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
--enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads
--enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2
--enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[h264 @ 000001967ec1ec00] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 000001967ec1ec00] decode_slice_header error
[h264 @ 000001967ec1ec00] no frame!
[h264 @ 000001967ec1ec00] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 000001967ec1ec00] decode_slice_header error
[h264 @ 000001967ec1ec00] no frame!
[mpegts @ 000001967ebfed00] start time for stream 0 is not set in
estimate_timings_from_pts
[mpegts @ 000001967ebfed00] start time for stream 1 is not set in
estimate_timings_from_pts
[mpegts @ 000001967ebfed00] Packet corrupt (stream = 0, dts = 590952620).
[mpegts @ 000001967ebfed00] Packet corrupt (stream = 0, dts = 590952620).
[mpegts @ 000001967ebfed00] Packet corrupt (stream = 0, dts = 590952620).
[mpegts @ 000001967ebfed00] stream 0 : no TS found at start of file,
duration not set
[mpegts @ 000001967ebfed00] stream 1 : no TS found at start of file,
duration not set
Input #0, mpegts, from 'soc_udp_rx_02.ts':
  Duration: N/A, bitrate: N/A
  Program 1
    Stream #0:0[0x1100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k
tbn, 100 tbc
    Stream #0:1[0x1110]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
Hz, stereo, fltp, 128 kb/s
File 'testaudio.mp4' already exists. Overwrite? [y/N] y
Output #0, mp4, to 'testaudio.mp4':
  Metadata:
    title           : media source exentions
    encoder         : Lavf58.47.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 90k tbn,
90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 000001967ebfed00] Packet corrupt (stream = 0, dts = 590952620).
frame=  902 fps=0.0 q=-1.0 Lsize=    1803kB time=00:00:18.09 bitrate=
816.3kbits/s speed= 816x
video:1469kB audio:277kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 3.293837%

For although there it says aac (LC) if I run mp4info on the resultant file
I get this:

mp4info testaudio.mp4
File:
  major brand:      iso5
  minor version:    200
  compatible brand: iso5
  compatible brand: iso6
  compatible brand: mp41
  fast start:       yes

Movie:
  duration:   0 ms
  time scale: 1000
  fragments:  yes

Found 2 Tracks
Track 1:
  flags:        3 ENABLED IN-MOVIE
  id:           1
  type:         Video
  duration: 0 ms
  language: und
  media:
    sample count: 0
    timescale:    90000
    duration:     0 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 664.930 Kbps
    sample count with fragments: 902
    duration with fragments:     1628337
    duration with fragments:     18093 (ms)
  display width:  1280.000000
  display height: 720.000000
  Sample Description 0
    Coding:      avc1 (H.264)
    Width:       1280
    Height:      720
    Depth:       24
    AVC Profile:          77 (Main)
    AVC Profile Compat:   0
    AVC Level:            40
    AVC NALU Length Size: 4
    AVC SPS: [674d00288994a02802dd80b502020240000003004000001921]
    AVC PPS: [68ee3c8000]
    Codecs String: avc1.4D0028
Track 2:
  flags:        3 ENABLED IN-MOVIE
  id:           2
  type:         Audio
  duration: 0 ms
  language: und
  media:
    sample count: 0
    timescale:    48000
    duration:     0 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 125.373 Kbps
    sample count with fragments: 848
    duration with fragments:     868354
    duration with fragments:     18091 (ms)
  Sample Description 0
    Coding:      mp4a (MPEG-4 Audio)
    Stream Type: Audio
    Object Type: MPEG-4 Audio
    Max Bitrate: 128250
    Avg Bitrate: 0
    Buffer Size: 0
    Codecs String: mp4a.40.0
    MPEG-4 Audio Object Type: 0 (UNKNOWN)
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2

whereas if I used -c:a aac -profile:a aac_low instead of -c:a copy then I
get this from mp4info:
Track 2:
  flags:        3 ENABLED IN-MOVIE
  id:           2
  type:         Audio
  duration: 0 ms
  language: und
  media:
    sample count: 0
    timescale:    48000
    duration:     0 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 49.589 Kbps
    sample count with fragments: 849
    duration with fragments:     869378
    duration with fragments:     18112 (ms)
  Sample Description 0
    Coding:      mp4a (MPEG-4 Audio)
    Stream Type: Audio
    Object Type: MPEG-4 Audio
    Max Bitrate: 128000
    Avg Bitrate: 0
    Buffer Size: 0
    Codecs String: mp4a.40.2
    MPEG-4 Audio Object Type: 2 (AAC Low Complexity)
    MPEG-4 Audio Decoder Config:
      Sampling Frequency: 48000
      Channels: 2
      Extension:
        Object Type: Spectral Band Replication
        SBR Present: no
        PS Present:  no
        Sampling Frequency: 0
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2

where it clearly states it as Mpeg-4 Audio AAC Low complexity.

Any help gratefully received,
Thanks,
Simon


More information about the ffmpeg-user mailing list