nareix / joy4

Golang audio/video library and streaming server
MIT License
2.66k stars 501 forks source link

TS file generated contains invalid aac sample rate #64

Open alexj212 opened 6 years ago

alexj212 commented 6 years ago

I am generating TS files, and the aac track sample rate is not stored correctly. The sample rate is set to 48000, 1 channel, AOT_AAC_LC.

    mPEG4AudioConfig := aacparser.MPEG4AudioConfig{
        SampleRate:      48000,
        SampleRateIndex: 0, // if 0 will be calculated
        ChannelConfig: 0,                  // if 0 it will be calculated
        ChannelLayout: av.CH_FRONT_CENTER,
        ObjectType: aacparser.AOT_AAC_LC,
    }
ffprobe version 4.0 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --prefix=/home/alexj/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/alexj/ffmpeg_build/include --extra-ldflags=-L/home/alexj/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/alexj/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[aac @ 0x4b2fc40] Multiple frames in a packet.
[aac @ 0x4b2fc40] channel element 2.6 is not allocated
    Last message repeated 166 times
[mpegts @ 0x4b29ec0] decoding for stream 1 failed
[mpegts @ 0x4b29ec0] Could not find codec parameters for stream 1 (Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 52 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'tmp.ts':
  Duration: 00:00:03.57, start: 56548.874933, bitrate: 266 kb/s
  Program 1 
    Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(progressive), 360x640, 90k tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 52 kb/s