Opened 9 years ago

Closed 9 years ago

#4268 closed defect (worksforme)

ffmpeg exits with zero exit code for partial input file

Reported by: Herbert Vojčík Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i file:truncated.mp4 -f image2 %d.png
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gn
utls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopenco
re-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-l
ibxavs --enable-libxvid --enable-zlib

Output contains

[mov,mp4,m4a,3gp,3g2,mj2 @ 00399700] stream 0, offset 0xc69c: partial file
app\ssv-hub\test\fixture\2-truncated.mp4: Invalid data found when processing input

Nevertheless, exit code is 0. I presume it should not be.

I got this reply in irc channel:

[15:52] <c_14> hmm, utils.c appears to be ignoring AVERROR_INVALIDDATA
[15:52] <c_14> Not entirely sure why.
[15:53] <c_14> Make a bug report on trac mentioning it

Attachments (1)

2-truncated.mp4 (48.8 KB ) - added by Herbert Vojčík 9 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Herbert Vojčík, 9 years ago

Summary: ffmpeg exits with code for partial input fileffmpeg exits with zero exit code for partial input file

comment:2 by Bl@cK, 9 years ago

/del

Last edited 9 years ago by Bl@cK (previous) (diff)

comment:3 by Michael Niedermayer, 9 years ago

Cc: Michael Niedermayer added

How can this be reproduced ?
can you provide the input file?

comment:4 by Matt Joiner, 9 years ago

I have this when passing a http input.

ffmpeg -i http://some/thing ...

If the source URI terminates prematurely, such as by me shutting down the server that provides it, I get this:

[mpeg4 @ 0x2bbbd20] illegal MB_type 4757kB time=00:01:09.46 bitrate= 561.0kbits/s dup=1 drop=0
[mpeg4 @ 0x2bbbd20] Error at MB: 67
[mpeg4 @ 0x2bbbd20] concealing 1376 DC, 1376 AC, 1376 MV errors in B frame
[mp4 @ 0x2617380] Starting second pass: moving the moov atom to the beginning of the file

$ echo $?
0

Interesting that the second pass moov_faststart still occurs, maybe that contributes.

Here's the redacted arguments:

"ffmpeg" "-hide_banner" "-i" "http://some/path" "-vf" "scale='trunc(oh*a/2)*2:min(ih
,480)'" "-profile:v" "baseline" "-level" "3.0" "-preset" "veryfast" "-movflags" "+faststart" "-maxrate" "170KB" "-bufsize" "340KB" "-y" "f2b7ba5104c1059a2c3bf7c7563d964f.mp4"

comment:5 by Matt Joiner, 9 years ago

ffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)

comment:6 by Michael Niedermayer, 9 years ago

You can probably achive this by using -xerror

comment:7 by Matt Joiner, 9 years ago

I notice -xerror doesn't come up in any manual pages or documentation I can find.

comment:8 by Matt Joiner, 9 years ago

-xerror didn't change the exit code.

by Herbert Vojčík, 9 years ago

Attachment: 2-truncated.mp4 added

comment:9 by Carl Eugen Hoyos, 9 years ago

Resolution: worksforme
Status: newclosed
$ ffmpeg -xerror -i 2-truncated.mp4 -f null -
ffmpeg version N-73187-g1221b7d Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 45.100 / 56. 45.100
  libavformat    56. 38.102 / 56. 38.102
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 18.100 /  5. 18.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2-truncated.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-08-27 20:37:14
  Duration: 00:00:04.99, start: 0.000000, bitrate: 80 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 478x360, 263 kb/s, 29.92 fps, 29.92 tbr, 359 tbn, 59.83 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2012-08-27 20:37:14
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf56.38.102
    Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 478x360, q=2-31, 200 kb/s, 29.92 fps, 29.92 tbn, 29.92 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
      encoder         : Lavc56.45.100 rawvideo
    Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
    Metadata:
      creation_time   : 2012-08-27 20:37:14
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
      encoder         : Lavc56.45.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[null @ 0x37131a0] Encoder did not produce proper pts, making some up.
[aac @ 0x3712460] decode_band_types: Input buffer exhausted before END element found
Error while decoding stream #0:1: Invalid data found when processing input
Conversion failed!
$ echo $?
1

-xerror is documented in 5.11 Advanced options on https://ffmpeg.org/ffmpeg-all.html and in the full help output of ffmpeg.

Note: See TracTickets for help on using tickets.