id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
566	Encoding AAC stereo audio which starts silently to mpeg-ts causes 0-channel audio output.	tungj		"When encoding a video with stereo audio which starts with 6 seconds of silence to mpeg-ts, 'ffprobe' on the output .ts reports it to have an audio track with 0 channels of audio despite the audio playing in FFplay and vlc. This means the 0-channel audio stream is lost (in newest GIT N-33724-gefb1ce2 FFmpeg with libfaac 1.28), or causes an 'encoding 0 channels is not allowed' error in older FFmpeg git-N-29122-gb8a4444 libfaac 1.26 builds when doing any encoding on that output later on. 

Encoding the video to mpeg-ts:

{{{
tungj@tungj-ffmpeg:~/bugreport$ ffmpeg -y -i 'initialSilence.mp4' -f mpegts -t 10 -acodec libfaac -ab 40k -ar 22050 initialSilence.ts
ffmpeg version N-33724-gefb1ce2, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 17 2011 11:00:29 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 20. 1 / 53. 20. 1
  libavformat  53. 16. 0 / 53. 16. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 6 /  2. 43. 6
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'initialSilence.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.16.0
  Duration: 00:00:10.02, start: 0.000000, bitrate: 84 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 200x200, 5 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 72 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
[buffer @ 0xa9fc620] w:200 h:200 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
[mpegts @ 0xa9fc6e0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'initialSilence.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.16.0
    Stream #0:0(und): Video: mpeg2video, yuv420p, 200x200, q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0:1(und): Audio: aac, 22050 Hz, stereo, s16, 40 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Stream mapping:
  Stream #0.0 -> #0.0 (h264 -> mpeg2video)
  Stream #0.1 -> #0.1 (aac -> libfaac)
Press [q] to stop, [?] for help
frame=  250 fps=  0 q=2.0 Lsize=     197kB time=00:00:09.96 bitrate= 161.7kbits/s    
video:124kB audio:34kB global headers:0kB muxing overhead 24.226776%
}}}

The mpegts stream claims to have zero channels: 

{{{
tungj@tungj-ffmpeg:~/bugreport$ ffmpeg -v 9 -loglevel 99 -i initialSilence.ts
ffmpeg version N-33724-gefb1ce2, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 17 2011 11:00:29 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 20. 1 / 53. 20. 1
  libavformat  53. 16. 0 / 53. 16. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 6 /  2. 43. 6
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpegts @ 0x9c24aa0] Format mpegts probed with size=2048 and score=100
[mpegts @ 0x9c24aa0] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x9c24aa0] stream=1 stream_type=f pid=101 prog_reg_desc=
[aac @ 0x9c290c0] Unsupported bit depth: 0
[mpeg2video @ 0x9c288e0] Unsupported bit depth: 0
[mpegts @ 0x9c24aa0] max_analyze_duration 5000000 reached at 5000000
[NULL @ 0x9c290c0] start time is not set in estimate_timings_from_pts
Input #0, mpegts, from 'initialSilence.ts':
  Duration: 00:00:09.96, start: 1.400000, bitrate: 161 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 127, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 200x200 [SAR 1:1 DAR 1:1], 1/50, 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](und), 0, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, s16
At least one output file must be specified
}}}

When doing futher processing, the original audio is lost in output.mp4:

{{{
tungj@tungj-ffmpeg:~/bugreport$ ffmpeg -y -i 'initialSilence.ts' -vcodec copy -acodec libfaac -ab 40k -ar 22050 output.mp4
ffmpeg version N-33724-gefb1ce2, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 17 2011 11:00:29 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 20. 1 / 53. 20. 1
  libavformat  53. 16. 0 / 53. 16. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 6 /  2. 43. 6
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpegts @ 0x9346aa0] max_analyze_duration 5000000 reached at 5000000
[NULL @ 0x934b0c0] start time is not set in estimate_timings_from_pts
Input #0, mpegts, from 'initialSilence.ts':
  Duration: 00:00:09.96, start: 1.400000, bitrate: 161 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 200x200 [SAR 1:1 DAR 1:1], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels, s16
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf53.16.0
    Stream #0:0: Video: mpeg2video (a[0][0][0] / 0x0061), yuv420p, 200x200 [SAR 1:1 DAR 1:1], q=2-31, 104857 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (copy)
Press [q] to stop, [?] for help
frame=  250 fps=  0 q=-1.0 Lsize=     127kB time=00:00:09.96 bitrate= 104.5kbits/s    
video:124kB audio:0kB global headers:0kB muxing overhead 2.308019%
}}}

Details of the input file: 

{{{
tungj@tungj-ffmpeg:~/bugreport$ ffmpeg -v 9 -loglevel 99 -i initialSilence.mp4 
ffmpeg version N-33724-gefb1ce2, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 17 2011 11:00:29 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 20. 1 / 53. 20. 1
  libavformat  53. 16. 0 / 53. 16. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 6 /  2. 43. 6
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xa374aa0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xa374aa0] ISO: File Type Major Brand: isom
[aac @ 0xa3852a0] Unsupported bit depth: 0
[h264 @ 0xa37b5c0] no picture
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xa374aa0] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'initialSilence.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.16.0
  Duration: 00:00:10.02, start: 0.000000, bitrate: 84 kb/s
    Stream #0:0(und), 3, 1/25: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 200x200, 1/50, 5 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 72 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
At least one output file must be specified
}}}


Interestingly, the problem seems to occur at the silence-to-audio boundary; encoding either before the sound starts
    ffmpeg -y -i 'initialSilence.mp4' -f mpegts -t 5 -acodec libfaac -ab 40k -ar 22050 initialSilence.ts
or after the silence ends
    ffmpeg -y -i 'initialSilence.mp4' -f mpegts -ss 8 -acodec libfaac -ab 40k -ar 22050 initialSilence.ts
produce mpegts files which ffprobe reports as having stereo audio output."	defect	closed	normal	avformat	git-master	fixed	aac mpegts				1	0
