Opened 7 years ago

Closed 7 years ago

#6671 closed defect (fixed)

FFMPEG does not convert a file with invalid metadata

Reported by: xtemp09 Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: mkv chapters regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

If FFMPEG finds out that the file contains wrong metadata, it does not convert it, even if the metadata is not necessary:

$ cat ffmpeg-20170917-172025.log
ffmpeg started on 2017-09-17 at 17:20:25
Report written to "ffmpeg-20170917-172025.log"
Command line:
./ffmpeg -i "/mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv" -c copy -f matroska -report -y /dev/null
ffmpeg version N-87286-g6ce4a635ed-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.105.100 / 57.105.100
  libavformat    57. 82.100 / 57. 82.100
  libavdevice    57.  8.100 / 57.  8.100
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument '/mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'matroska'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/dev/null' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv.
Successfully parsed a group of options.
Opening an input file: /mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv.
[NULL @ 0x5de9460] Opening '/mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv' for reading
[file @ 0x5de9c80] Setting default whitelist 'file,crypto'
[matroska,webm @ 0x5de9460] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x5de9460] Before avformat_find_stream_info() pos: 14165 bytes read:32768 seeks:0 nb_streams:2
[h264 @ 0x5dee640] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x5dee640] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x5dee640] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x5dee640] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5dee640] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x5dee640] no picture
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[h264 @ 0x5dee640] ct_type:1 pic_struct:0
[matroska,webm @ 0x5de9460] All info found
[matroska,webm @ 0x5de9460] After avformat_find_stream_info() pos: 1082096 bytes read:1082096 seeks:0 frames:10
Input #0, matroska,webm, from '/mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv':
  Metadata:
    encoder         : libebml v1.2.0 + libmatroska v1.1.0
    creation_time   : 2011-07-28T08:17:03.000000Z
  Duration: 00:24:41.03, start: 0.000000, bitrate: 33616 kb/s
    Chapter #0:0: start 105.021000, end 721.071000
    Metadata:
      title           : Part A
    Chapter #0:1: start 721.071000, end 1203.911000
    Metadata:
      title           : Part B
    Chapter #0:2: start 1203.911000, end 1481.025000
    Metadata:
      title           : ED
    Chapter #0:3: start 1486.026000, end 1481.025000
    Metadata:
      title           : Preview
    Stream #0:0, 6, 1/1000: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(jpn), 4, 1/1000: Audio: flac, 48000 Hz, stereo, s16 (default)
Successfully opened the file.
Parsing a group of options: output url /dev/null.
Applying option c (codec name) with argument copy.
Applying option f (force format) with argument matroska.
Successfully parsed a group of options.
Opening an output file: /dev/null.
[file @ 0x5e161c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, matroska, to '/dev/null':
  Metadata:
    encoder         : Lavf57.82.100
    Chapter #0:0: start 105.021000, end 721.071000
    Metadata:
      title           : Part A
    Chapter #0:1: start 721.071000, end 1203.911000
    Metadata:
      title           : Part B
    Chapter #0:2: start 1203.911000, end 1481.025000
    Metadata:
      title           : ED
    Chapter #0:3: start 1486.026000, end 1481.025000
    Metadata:
      title           : Preview
    Stream #0:0, 0, 1/1000: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(jpn), 0, 1/1000: Audio: flac ([172][241][0][0] / 0xF1AC), 48000 Hz, stereo, s16 (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[matroska @ 0x5e3ada0] get_metadata_duration returned: 0
[matroska @ 0x5e3ada0] Invalid chapter start (1486026000000) or end (1481025000000).
av_interleaved_write_frame(): Invalid data found when processing input
No more output streams to write to, finishing.
Error writing trailer of /dev/null: Invalid data found when processing input
frame=    1 fps=0.0 q=-1.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x
video:230kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (/mnt/svalka/media_files/shana/Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv):
  Input stream #0:0 (video): 1 packets read (235318 bytes);
  Input stream #0:1 (audio): 1 packets read (1965 bytes);
  Total: 2 packets (237283 bytes) demuxed
Output file #0 (/dev/null):
  Output stream #0:0 (video): 1 packets muxed (235318 bytes);
  Output stream #0:1 (audio): 1 packets muxed (1965 bytes);
  Total: 2 packets (237283 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x5e14a80] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x5df1e80] Statistics: 1082096 bytes read, 0 seeks
Conversion failed!

The file is played normally, however FFMPEG refuses to convert.

Attachments (1)

Change History (8)

comment:1 by Carl Eugen Hoyos, 7 years ago

Please provide a sample.

comment:2 by xtemp09, 7 years ago

cehoyos, https://rutracker.net/forum/viewtopic.php?t=3664800
The 24th episode (season finale).

comment:3 by xtemp09, 7 years ago

I can't mux it and cut to provide a sample because of aforementioned bug. Perhaps, the ffprobe output would be helpful:

$ ffprobe Shakugan\ no\ Shana\ 24\ \[BDRemux\ 1920x1080\ AVC\ FLAC\].mkv
ffprobe version 3.3.4-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=snd=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-ame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --eibspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebple-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, matroska,webm, from 'Shakugan no Shana 24 [BDRemux 1920x1080 AVC FLAC].mkv':
  Metadata:
    encoder         : libebml v1.2.0 + libmatroska v1.1.0
    creation_time   : 2011-07-28T08:17:03.000000Z
  Duration: 00:24:41.03, start: 0.000000, bitrate: 33616 kb/s
    Chapter #0:0: start 105.021000, end 721.071000
    Metadata:
      title           : Part A
    Chapter #0:1: start 721.071000, end 1203.911000
    Metadata:
      title           : Part B
    Chapter #0:2: start 1203.911000, end 1481.025000
    Metadata:
      title           : ED
    Chapter #0:3: start 1486.026000, end 1481.025000
    Metadata:
      title           : Preview
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbclt)
    Stream #0:1(jpn): Audio: flac, 48000 Hz, stereo, s16 (default)


Last edited 7 years ago by xtemp09 (previous) (diff)

in reply to:  3 comment:4 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavformat
Keywords: mkv chapters regression added; metadata removed
Priority: importantminor
Reproduced by developer: set

Replying to xtemp09:

I can't mux it and cut to provide a sample because of aforementioned bug.

Did you try to use dd as suggested on https://ffmpeg.org/bugreports.html?

Perhaps, the ffprobe output would be helpful:

Apart from Only current FFmpeg git head is supported here:
Do you see any difference compared to your original console output?

Patch sent.

comment:5 by xtemp09, 7 years ago

If you mean version, FFMPEG is the git latest, ffprobe is stable.

Might I ask what patch has been sent? The latest commits in the git repository do not contain the metadata patch.

comment:6 by xtemp09, 7 years ago

ffmpeg -i bad.mp4 -c copy -f matroska -y NUL

Gives the same error.

https://www.dropbox.com/s/pixoh077u9bome5/bad.mp4?dl=0

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

Resolution: fixed
Status: newclosed

Replying to xtemp09:

ffprobe is stable.

There is nothing unstable about current FFmpeg git head, releases are snapshots for distributors.

Should be fixed in 2f3a3a7e3270d9c4486fc4d1ed708c2f54338f9c

Note: See TracTickets for help on using tickets.