Opened 4 months ago

Last modified 4 months ago

#11089 new defect

Error reading header: ffmpeg can do nothing with h265 mp4

Reported by: sgordeev Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I got a few files from my customer which ffmpeg can do nothing. I'm getting "error reading header" without any details. I'm trying to read metadata from these files and prepare them for streaming. The files are playing well locally with VLC. It seems the files were corrupted somehow but I can't understand what's wrong and how to fix them. I've already tried all possible versions of ffmpeg: 3.4, 4.3, 6, 7 and git-master - the same error all the time.

How to reproduce:

% ffmpeg -i b40e54da93554c9f95c2774abc360069.mp4 -c copy out.mp4                                                                                      
ffmpeg version N-116067-g5d54a25eea Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-4ubuntu3)
  configuration: --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      59. 27.100 / 59. 27.100
  libavcodec     61.  9.100 / 61.  9.100
  libavformat    61.  4.100 / 61.  4.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5e06d2a389c0] error reading header
[in#0 @ 0x5e06d2a38700] Error opening input: Invalid data found when processing input
Error opening input file b40e54da93554c9f95c2774abc360069.mp4.
Error opening input files: Invalid data found when processing input
% ffprobe -loglevel debug  -print_format json -show_format -show_streams  b40e54da93554c9f95c2774abc360069.mp4                                        
ffprobe version N-116067-g5d54a25eea Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-4ubuntu3)
  configuration: --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      59. 27.100 / 59. 27.100
  libavcodec     61.  9.100 / 61.  9.100
  libavformat    61.  4.100 / 61.  4.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
{
[AVFormatContext @ 0x603dace8b6c0] Opening 'b40e54da93554c9f95c2774abc360069.mp4' for reading
[file @ 0x603dace6c3c0] Setting default whitelist 'file,crypto,data'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] Unknown dref type 0x206c7275 size 12
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] Processing st: 1, edit list 0 - media time: -1, duration: 5746
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] Processing st: 1, edit list 1 - media time: 0, duration: 4178880
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x603dace8b6c0] error reading header
[AVIOContext @ 0x603dace93d40] Statistics: 71047 bytes read, 1 seeks
b40e54da93554c9f95c2774abc360069.mp4: Invalid data found when processing input

}

A full debug log and an example of the file are attached.

Attachments (2)

loglevel99.txt (976.1 KB ) - added by sgordeev 4 months ago.
debug log with loglevel 99
media_info.png (91.6 KB ) - added by sgordeev 4 months ago.
Media info from VLC

Download all attachments as: .zip

Change History (5)

by sgordeev, 4 months ago

Attachment: loglevel99.txt added

debug log with loglevel 99

by sgordeev, 4 months ago

Attachment: media_info.png added

Media info from VLC

comment:2 by Balling, 4 months ago

-v trace shows it breaks on

[mov,mp4,m4a,3gp,3g2,mj2 @ 000002348df9e900] type:'stsc' parent:'root' sz: 304 79181670 79181824
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002348df9e900] error reading header
[AVIOContext @ 000002348e0bf6c0] Statistics: 71047 bytes read, 1 seeks

in reply to:  2 comment:3 by sgordeev, 4 months ago

is it possible to ignore broken parts? and encode the file to h264.
I've already tried the following:

% ffmpeg -err_detect ignore_err -i b40e54da93554c9f95c2774abc360069.mp4 -c copy out.mp4                                                               
ffmpeg version N-116067-g5d54a25eea Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-4ubuntu3)
  configuration: --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      59. 27.100 / 59. 27.100
  libavcodec     61.  9.100 / 61.  9.100
  libavformat    61.  4.100 / 61.  4.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x586db5090a00] error reading header
[in#0 @ 0x586db5090740] Error opening input: Invalid data found when processing input
Error opening input file b40e54da93554c9f95c2774abc360069.mp4.
Error opening input files: Invalid data found when processing input

Replying to Balling:

-v trace shows it breaks on

[mov,mp4,m4a,3gp,3g2,mj2 @ 000002348df9e900] type:'stsc' parent:'root' sz: 304 79181670 79181824
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002348df9e900] error reading header
[AVIOContext @ 000002348e0bf6c0] Statistics: 71047 bytes read, 1 seeks
Note: See TracTickets for help on using tickets.