Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2159 closed defect (worksforme)

FFMPEG not consistently identifying audio tracks and selects audio track with no data

Reported by: ramitb Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: wtv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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

Change History (9)

in reply to:  description comment:1 by Carl Eugen Hoyos, 11 years ago

Resolution: worksforme
Status: newclosed

Replying to ramitbhalla:

[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

Please reopen this ticket if you believe this message can be improved.

$ ffmpeg -i The\ Adventures\ of\ Abney\ and\ Teal_CBeebies_2013_01_03_17_55_00.wtv -map 0:0 -map 0:1 -acodec copy -vcodec copy out.ts
$ ffmpeg -probesize 85M -analyzeduration 250M -i out.ts
ffmpeg version N-49028-ga5faae4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 19 2013 14:54:44 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 15.100 / 52. 15.100
  libavcodec     54. 89.100 / 54. 89.100
  libavformat    54. 61.101 / 54. 61.101
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.101 /  3. 32.101
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x24716e0] max_analyze_duration 250000000 reached at 250000000 microseconds
Input #0, mpegts, from 'out.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](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 64 kb/s (hearing impaired)
    Stream #0:1[0x101]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
At least one output file must be specified

comment:2 by ramitb, 11 years ago

Am reopening the ticket, if there is an audio track with no audio / 0 channels it should NOT report it as stereo, it should report it as 0 channels:

Stream #0:0[0x75](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s (hearing impaired)

You've given a "work around" by using the map function. The issue is when applications are parsing the output of ffmpeg they are expecting it to have a stereo audio track when actually there isn't one it messes everything up.

The right output should be a 0 channel audio track like it gives it after remuxing to the TS format.

Also, if there are no audio channels detected, FFMPEG should NOT select the audio track when using the -acodec copy paramater (without the map workaround)

comment:3 by ramitb, 11 years ago

Resolution: worksforme
Status: closedreopened

comment:4 by ramitb, 11 years ago

This is very incorrect:

Guessed Channel Layout for Input Stream #0.0 : stereo

It should give this (like the TS file does):

Stream #0:1[0x101](eng): Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, s16p (hearing impaired)

I don't understand why in the TS file it reports it correctly as 0 channels while in the WTV file it "guesses" 2 channels.

If this is correctly done, then I think it solves the problem of selecting the "wrong" default audio also. I remember reading in some documentation that ffmpeg chooses the audio track with the highest bit rate/channels etc - which is EXCELLENT, except this guessing has completely messed it up.

3rd Party application depend heavily on the output of the "Stream #" line, so any mess up there will completely mess things up.

in reply to:  description comment:5 by Carl Eugen Hoyos, 11 years ago

Keywords: wtv added
Resolution: worksforme
Status: reopenedclosed

Replying to ramitbhalla:

[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

Sorry, I slightly misread the ticket yesterday.
Again, please feel free to reopen the ticket if you believe that above message is unclear!
Stream 0x75 is indeed a mono stream but FFmpeg correctly warns that it may have incorrectly read the stream properties.
The following command line allows to correctly detect the mono stream (and allows the automatic stream selection for -acodec copy to choose the channel that you seem to prefer in your output file for this specific input file).

$ ffmpeg -probesize 100M -analyzeduration 250M -i The\ Adventures\ of\ Abney\ and\ Teal_CBeebies_2013_01_03_17_55_00.wtv
ffmpeg version N-49055-g60af6c3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 20 2013 15:48:14 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 15.100 / 52. 15.100
  libavcodec     54. 89.100 / 54. 89.100
  libavformat    54. 61.101 / 54. 61.101
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.101 /  3. 32.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[wtv @ 0x21136e0] truncated file
    Last message repeated 2 times
[mpeg2video @ 0x2118ba0] 0x0 is invalid
    Last message repeated 18 times
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/WMRVExpirationDate: 9999-12-31 23:59:59
    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:24:41.11, start: 2.006284, bitrate: 4446 kb/s
    Stream #0:0[0x75](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, mono, s16p, 64 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 tbc
    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

in reply to:  2 comment:6 by Carl Eugen Hoyos, 11 years ago

Replying to ramitbhalla:

Am reopening the ticket, if there is an audio track with no audio / 0 channels it should NOT report it as stereo, it should report it as 0 channels:

Stream #0:0[0x75](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s (hearing impaired)

I am not sure I understand: The wtv sample you uploaded contains two audio streams, one of them is a mono mp2 stream with id 0x75. Why should FFmpeg report this stream with 0 channels?

You've given a "work around" by using the map function.

No, I think you misunderstand: Your original command line was "ffmpeg -i input -vcodec copy -acodec copy out.ts" and the output of your command showed that ffmpeg chose the streams "0:0" and "0:1" as streams to copy. My command line is "ffmpeg -i input -map 0:0 -map 0:1 -vcodec copy -acodec copy out.ts" just for clarity, to make sure we are discussing the same streams. But the output file of my command line is of course binary identical no matter if I use -map or not.
I slightly misunderstood the ticket yesterday but wanted to clarify that there is an audio stream 0x75 (and it has more than 0 channels) and that audio stream is copied correctly by FFmpeg (I tested A/V sync shortly and it works fine afaict).

The issue is when applications are parsing the output of ffmpeg they are expecting it to have a stereo audio track when actually there isn't one it messes everything up.

FFmpeg warns that the stream parameters may not be correctly, I don't think much more can be done.

The right output should be a 0 channel audio track like it gives it after remuxing to the TS format.

I don't understand: The relevant audio input stream we are discussing has one channel and this channel can be copied correctly into the transport stream (output file) - why should it be shown as having 0 channels?

Also, if there are no audio channels detected, FFMPEG should NOT select the audio track when using the -acodec copy paramater (without the map workaround)

Please look again at my command line - as said I did not use a workaround with map, I only specified it to make it clear I am copying the same streams as you did.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:7 by ramitb, 11 years ago

Works like a charm thanks.

But there' still an issue, the Stream 0 which is NOW reported as Mono, doesn't actually contain any audio - in Window Media Center when I select that track there is no sound.
Are you sure it's Mono?

in reply to:  7 comment:8 by Carl Eugen Hoyos, 11 years ago

Replying to ramitbhalla:

But there' still an issue, the Stream 0 which is NOW reported as Mono, doesn't actually contain any audio

It does contain audio here...

I tried the following:
$ ffmpeg -i input -map 0:0 out.wav
$ ffmpeg -i input -map 0:0 -acodec copy out.mp2
Both output files play fine here, why do you believe that the stream does not contain any audio?

comment:9 by ramitb, 11 years ago

hmm wierd, that cause in Windows Media Center there is no audio when I select that track from the WTV file.

Note: See TracTickets for help on using tickets.