Opened 10 years ago

Closed 10 years ago

#3072 closed defect (duplicate)

FFMpeg fails sometimes when using converting H.264 to MPEGTS using h264_mp4toannexb

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

Description

Summary of the bug: When I'm trying to remux a H.264 file to a TS file, it fails warning about bitstream malformed and need to use h264_mp4toannexb.
When I include h264_mp4toannexb it tries to apply it to the audio stream (?? or am I misreading this) and then fails.

How to reproduce:

Here it prompts to include bitsteam filter:

ffmpeg -probesize 100M -analyzeduration 300M -y -ss 2 -i "..\Remux
Fail H264 Copy Stream.wtv"  -vcodec copy -acodec copy -map 0:a -map 0:3 -f mpegts test.ts
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[wtv @ 03c746c0] truncated file
[wtv @ 03c746c0] reported file length (0x7d3ab468) exceeds number of available sectors (0x40000000)
[wtv @ 03c746c0] truncated file
    Last message repeated 1 times
[h264 @ 024ed940] mmco: unref short failure
    Last message repeated 2 times
Input #0, wtv, from '..\Remux Fail H264 Copy Stream.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : Great British Railway Journeys
    WM/SubTitle     : Taunton to Minehead
    WM/SubTitleDescription: Michael Portillo explores a church that moves in mysterious ways and summons all his strengt
h, to move a one hundred and ten tonne steam locomotive.
    genre           : Documentary;Other
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Dave Minchin;Michael Portillo;
    service_provider: BBC HD
    service_name    : BBC HD
    WM/MediaOriginalChannel: 102
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-01-30T00:00:00Z
    WM/MediaOriginalRunTime: 19711177116
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    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-30 18:30:08
    WM/WMRVSeriesUID: !GenericSeries!Great British Railway Journeys
    WM/WMRVServiceID: !MCService!755567
    WM/WMRVProgramID: !MCProgram!49381242
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 17918570369
    WM/WMRVEndTime  : 2013-01-30 19:00:00
    WM/WMRVBitrate  : 9.382929
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 291
    WM/WMRVActualSoftPostPadding: 0
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 0
    WM/MediaThumbHeight: 0
    WM/MediaThumbStride: 0
    WM/MediaThumbRet: 4
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 19243776
    WM/MediaThumbAspectRatioX: 0
    WM/MediaThumbAspectRatioY: 0
    WM/MediaThumbTimeStamp: -4616189618054758400
  Duration: 00:14:59.19, start: 1.691285, bitrate: 2798 kb/s
    Stream #0:0[0x38](eng): Subtitle: dvb_subtitle
    Stream #0:1[0x39](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo, fltp (hearing impaired)
    Stream #0:2[0x3a](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo, fltp
    Stream #0:3[0x3b]: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 10000k tbn, 50 tbc
Output #0, mpegts, to 'test.ts':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : Great British Railway Journeys
    WM/SubTitle     : Taunton to Minehead
    WM/SubTitleDescription: Michael Portillo explores a church that moves in mysterious ways and summons all his strengt
h, to move a one hundred and ten tonne steam locomotive.
    genre           : Documentary;Other
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Dave Minchin;Michael Portillo;
    service_provider: BBC HD
    service_name    : BBC HD
    WM/MediaOriginalChannel: 102
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-01-30T00:00:00Z
    WM/MediaOriginalRunTime: 19711177116
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    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-30 18:30:08
    WM/WMRVSeriesUID: !GenericSeries!Great British Railway Journeys
    WM/WMRVServiceID: !MCService!755567
    WM/WMRVProgramID: !MCProgram!49381242
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 17918570369
    WM/WMRVEndTime  : 2013-01-30 19:00:00
    WM/WMRVBitrate  : 9.382929
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 291
    WM/WMRVActualSoftPostPadding: 0
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 0
    WM/MediaThumbHeight: 0
    WM/MediaThumbStride: 0
    WM/MediaThumbRet: 4
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 19243776
    WM/MediaThumbAspectRatioX: 0
    WM/MediaThumbAspectRatioY: 0
    WM/MediaThumbTimeStamp: -4616189618054758400
    encoder         : Lavf55.12.102
    Stream #0:0(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo (hearing impaired)
    Stream #0:1(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo
    Stream #0:2: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mpegts @ 03c638e0] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_
mp4toannexb)
av_interleaved_write_frame(): Invalid argument

After including the filter, it tries to apply it to the audio stream and fails. Am I doing something wrong here?

ffmpeg -probesize 100M -analyzeduration 300M -y -ss 2 -i "..\Remux
Fail H264 Copy Stream.wtv"  -vcodec copy -acodec copy -map 0:a -map 0:3 -f mpegts -bsf h264_mp4toannexb test.ts
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[wtv @ 03b8a760] truncated file
[wtv @ 03b8a760] reported file length (0x7d3ab468) exceeds number of available sectors (0x40000000)
[wtv @ 03b8a760] truncated file
    Last message repeated 1 times
[h264 @ 0253d2e0] mmco: unref short failure
    Last message repeated 2 times
Input #0, wtv, from '..\Remux Fail H264 Copy Stream.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : Great British Railway Journeys
    WM/SubTitle     : Taunton to Minehead
    WM/SubTitleDescription: Michael Portillo explores a church that moves in mysterious ways and summons all his strengt
h, to move a one hundred and ten tonne steam locomotive.
    genre           : Documentary;Other
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Dave Minchin;Michael Portillo;
    service_provider: BBC HD
    service_name    : BBC HD
    WM/MediaOriginalChannel: 102
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-01-30T00:00:00Z
    WM/MediaOriginalRunTime: 19711177116
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    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-30 18:30:08
    WM/WMRVSeriesUID: !GenericSeries!Great British Railway Journeys
    WM/WMRVServiceID: !MCService!755567
    WM/WMRVProgramID: !MCProgram!49381242
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 17918570369
    WM/WMRVEndTime  : 2013-01-30 19:00:00
    WM/WMRVBitrate  : 9.382929
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 291
    WM/WMRVActualSoftPostPadding: 0
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 0
    WM/MediaThumbHeight: 0
    WM/MediaThumbStride: 0
    WM/MediaThumbRet: 4
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 19243776
    WM/MediaThumbAspectRatioX: 0
    WM/MediaThumbAspectRatioY: 0
    WM/MediaThumbTimeStamp: -4616189618054758400
  Duration: 00:14:59.19, start: 1.691285, bitrate: 2798 kb/s
    Stream #0:0[0x38](eng): Subtitle: dvb_subtitle
    Stream #0:1[0x39](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo, fltp (hearing impaired)
    Stream #0:2[0x3a](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo, fltp
    Stream #0:3[0x3b]: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 10000k tbn, 50 tbc
Output #0, mpegts, to 'test.ts':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : Great British Railway Journeys
    WM/SubTitle     : Taunton to Minehead
    WM/SubTitleDescription: Michael Portillo explores a church that moves in mysterious ways and summons all his strengt
h, to move a one hundred and ten tonne steam locomotive.
    genre           : Documentary;Other
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Dave Minchin;Michael Portillo;
    service_provider: BBC HD
    service_name    : BBC HD
    WM/MediaOriginalChannel: 102
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-01-30T00:00:00Z
    WM/MediaOriginalRunTime: 19711177116
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    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-30 18:30:08
    WM/WMRVSeriesUID: !GenericSeries!Great British Railway Journeys
    WM/WMRVServiceID: !MCService!755567
    WM/WMRVProgramID: !MCProgram!49381242
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 17918570369
    WM/WMRVEndTime  : 2013-01-30 19:00:00
    WM/WMRVBitrate  : 9.382929
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 291
    WM/WMRVActualSoftPostPadding: 0
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 0
    WM/MediaThumbHeight: 0
    WM/MediaThumbStride: 0
    WM/MediaThumbRet: 4
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 19243776
    WM/MediaThumbAspectRatioX: 0
    WM/MediaThumbAspectRatioY: 0
    WM/MediaThumbTimeStamp: -4616189618054758400
    encoder         : Lavf55.12.102
    Stream #0:0(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo (hearing impaired)
    Stream #0:1(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo
    Stream #0:2: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
Press [q] to stop, [?] for help
[NULL @ 0253b9c0] Warning: SPS NALU missing or invalid. The resulting stream may not play.
[NULL @ 0253b9c0] Warning: PPS NALU missing or invalid. The resulting stream may not play.
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
[mpegts @ 046aa020] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_
mp4toannexb)
av_interleaved_write_frame(): Invalid argument

Attachments (1)

H264 Copy Remux Fail_cut.wtv (2.4 MB ) - added by Carl Eugen Hoyos 10 years ago.

Change History (7)

comment:1 by Carl Eugen Hoyos, 10 years ago

Resolution: needs_more_info
Status: newclosed

Please reopen this ticket if you can provide a sample.

comment:2 by ramitb, 10 years ago

I've uploaded a small chunk of the original file with which you can replicate the issue to the incoming directory.
It's called Ticket #3072.wtv

comment:3 by ramitb, 10 years ago

Resolution: needs_more_info
Status: closedreopened

by Carl Eugen Hoyos, 10 years ago

comment:4 by Carl Eugen Hoyos, 10 years ago

Could you explain the difference between this ticket and ticket #2220?
Is it possible that both use the sample samples and the same command lines?

comment:5 by ramitb, 10 years ago

apologies, I did a search for the keyword h264_mp4toannexb and I seem to have missed that ticket somehow. It is the same.

Gotto dig deeper next time.

comment:6 by Carl Eugen Hoyos, 10 years ago

Resolution: duplicate
Status: reopenedclosed
Note: See TracTickets for help on using tickets.