id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
2159	FFMPEG not consistently identifying audio tracks and selects audio track with no data	ramitbhalla		"Summary of the bug: FFMPEg is not able to consistently identity the audio tracks types. Sometimes it identifies audio tracks as having data when it does not actually have any data. Then when once tries to stream copy the audio tracks, it selects the track with no audio data in it.

The following file has been uploaded to the FFMPEG FTP server:
The Adventures of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv

How to reproduce:
First take a look at this properties of the file reported by FFMPEG:

{{{
ffmpeg -i ""The Adventures of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv""
ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helper
s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheo
ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-lib
vo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect

  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg2video @ 021de8c0] mpeg_decode_postinit() failure
    Last message repeated 18 times
[wtv @ 021dc640] max_analyze_duration 5000000 reached at 5016000
[wtv @ 021dc640] Could not find codec parameters for stream 0 (Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, 2 channels, s
16p, 256 kb/s): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wtv, from 'The Adventures of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : The Adventures of Abney and Teal
    WM/SubTitleDescription: CBeebies Bedtime Hour. The Mystery: Animated adventures of two friends who live on an island
 in the middle of the big city. Some of Abney and Teal's favourite objects are missing. [S]
    genre           : Kids;Other Kids
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;;;
    service_provider: CBeebies
    service_name    : CBeebies
    WM/MediaNetworkAffiliation: CBeebies
    WM/MediaOriginalChannel: 71
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 0001-01-01T00:00:00Z
    WM/MediaOriginalRunTime: 11978229000
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: false
    WM/WMRVEncodeTime: 2013-01-03 17:55:02
    WM/WMRVSeriesUID: !GenericSeries!The Adventures of Abney and Teal
    WM/WMRVServiceID: !Generated!ced17fb0888747b0b0b5a81bea9a64c8
    WM/WMRVProgramID: !Loaders!Glid!Programs!9018:4163:4672!53777
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 300
    WM/WMRVHardPrePadding: -120
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: false
    Duration        : 12375986000
    WM/WMRVEndTime  : 2013-01-03 18:15:39
    WM/WMRVBitrate  : 5.320834
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: 425
    WM/WMRVActualSoftPostPadding: 300
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 352
    WM/MediaThumbHeight: 281
    WM/MediaThumbStride: 1056
    WM/MediaThumbRet: 0
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 0
    WM/MediaThumbAspectRatioX: 16
    WM/MediaThumbAspectRatioY: 9
    WM/MediaThumbTimeStamp: 4649100181723190918
  Duration: 00:20:35.90, start: 2.006284, bitrate: 5328 kb/s
    Stream #0:0[0x75](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s (hearing impaired)
    Stream #0:1[0x76]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 10000k tbn, 50 t
bc
    Stream #0:2[0x77](eng): Subtitle: dvb_subtitle
    Stream #0:3[0x79](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s
At least one output file must be specified
}}}

This identifies Stream 0 as a MP2 audio track with stereo configuration, when actually there is no audio in the track! (playback with Windows MEdia Center and select 2nd audio track, no audio).

Now when I try to stream copy it, it select the No Audio track instead of the one with Audio

{{{
ffmpeg -i ""The Adventures of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv"" -vcodec copy
 -acodec copy test.ts

ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helper
s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheo
ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-lib
vo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect

  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg2video @ 01f8e9a0] mpeg_decode_postinit() failure
    Last message repeated 18 times
[wtv @ 01f8ca60] max_analyze_duration 5000000 reached at 5016000
[wtv @ 01f8ca60] Could not find codec parameters for stream 0 (Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, 2 channels, s
16p, 256 kb/s): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wtv, from 'The Adventures of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : The Adventures of Abney and Teal
    WM/SubTitleDescription: CBeebies Bedtime Hour. The Mystery: Animated adventures of two friends who live on an island
 in the middle of the big city. Some of Abney and Teal's favourite objects are missing. [S]
    genre           : Kids;Other Kids
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;;;
    service_provider: CBeebies
    service_name    : CBeebies
    WM/MediaNetworkAffiliation: CBeebies
    WM/MediaOriginalChannel: 71
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 0001-01-01T00:00:00Z
    WM/MediaOriginalRunTime: 11978229000
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: false
    WM/WMRVEncodeTime: 2013-01-03 17:55:02
    WM/WMRVSeriesUID: !GenericSeries!The Adventures of Abney and Teal
    WM/WMRVServiceID: !Generated!ced17fb0888747b0b0b5a81bea9a64c8
    WM/WMRVProgramID: !Loaders!Glid!Programs!9018:4163:4672!53777
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 300
    WM/WMRVHardPrePadding: -120
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: false
    Duration        : 12375986000
    WM/WMRVEndTime  : 2013-01-03 18:15:39
    WM/WMRVBitrate  : 5.320834
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: 425
    WM/WMRVActualSoftPostPadding: 300
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 352
    WM/MediaThumbHeight: 281
    WM/MediaThumbStride: 1056
    WM/MediaThumbRet: 0
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 0
    WM/MediaThumbAspectRatioX: 16
    WM/MediaThumbAspectRatioY: 9
    WM/MediaThumbTimeStamp: 4649100181723190918
  Duration: 00:20:35.90, start: 2.006284, bitrate: 5328 kb/s
    Stream #0:0[0x75](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s (hearing impaired)
    Stream #0:1[0x76]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 10000k tbn, 50 t
bc
    Stream #0:2[0x77](eng): Subtitle: dvb_subtitle
    Stream #0:3[0x79](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s
Output #0, mpegts, to 'test.ts':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : The Adventures of Abney and Teal
    WM/SubTitleDescription: CBeebies Bedtime Hour. The Mystery: Animated adventures of two friends who live on an island
 in the middle of the big city. Some of Abney and Teal's favourite objects are missing. [S]
    genre           : Kids;Other Kids
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;;;
    service_provider: CBeebies
    service_name    : CBeebies
    WM/MediaNetworkAffiliation: CBeebies
    WM/MediaOriginalChannel: 71
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 0001-01-01T00:00:00Z
    WM/MediaOriginalRunTime: 11978229000
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: false
    WM/WMRVEncodeTime: 2013-01-03 17:55:02
    WM/WMRVSeriesUID: !GenericSeries!The Adventures of Abney and Teal
    WM/WMRVServiceID: !Generated!ced17fb0888747b0b0b5a81bea9a64c8
    WM/WMRVProgramID: !Loaders!Glid!Programs!9018:4163:4672!53777
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 300
    WM/WMRVHardPrePadding: -120
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: false
    Duration        : 12375986000
    WM/WMRVEndTime  : 2013-01-03 18:15:39
    WM/WMRVBitrate  : 5.320834
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: 425
    WM/WMRVActualSoftPostPadding: 300
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 352
    WM/MediaThumbHeight: 281
    WM/MediaThumbStride: 1056
    WM/MediaThumbRet: 0
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 0
    WM/MediaThumbAspectRatioX: 16
    WM/MediaThumbAspectRatioY: 9
    WM/MediaThumbTimeStamp: 4649100181723190918
    encoder         : Lavf54.49.102
    Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps, 90k tbn, 25 tbc
    Stream #0:1(eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, 256 kb/s (hearing impaired)
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=30894 fps=2808 q=-1.0 Lsize=  331695kB time=00:20:36.80 bitrate=2197.0kbits/s
video:300633kB audio:5198kB subtitle:0 global headers:0kB muxing overhead 8.456973%
}}}

Now if I check the properties of the output file generated by FFMPEG, NOW it says the audio track has no data, but it's 2 late since it originally incorrectly identified the audio track as having data and then copied the wrong track (if I'm correct ffmpeg automatically selects the audio track with the highest quality of audio).

{{{
ffmpeg -i test.ts

ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helper
s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheo
ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-lib
vo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect

  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 002fc960] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 002fc960] Could not find codec parameters for stream 1 (Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, s16p):
 unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[NULL @ 002ff9e0] start time is not set in estimate_timings_from_pts
Input #0, mpegts, from 'test.ts':
  Duration: 00:20:35.76, start: 2.520144, bitrate: 2198 kb/s
  Program 1
    Metadata:
      service_name    : CBeebies
      service_provider: CBeebies
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps,
 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](eng): Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, s16p (hearing impaired)
At least one output file must be specified

}}}
"	defect	closed	normal	undetermined	unspecified	worksforme	wtv				0	0
