[FFmpeg-user] Debugging a broken mp4 (h.264/aac)

Mark J. Pearrow mpearrow at csail.mit.edu
Fri Jun 26 18:55:22 CEST 2015


Hi all,

I am using a hand-compiled version of ffmpeg on an Ubuntu 12.04 64-bit system to capture a live MP4 stream from a VBrick video appliance to disk, using the following command:

/opt/bin/ffmpeg -i <VBRICK RTSP URL> -acodec copy -vcodec h264 <OUTPUT FILENAME>

This works just fine 99.9 percent of the time. However, this process will occasionally produce videos that seem OK according to ffprobe, and will play fine, but they only consist of the first frame of the video and no audio. The file size is always approximately what you’d expect for a video of that duration.

I can’t tell if these files are just garbage, or if the video and audio data are in there somewhere. I am also not sure how these specific files end up broken. I had suspected that they broke due to the ffmpeg process that was writing them to disk might have terminated abnormally, but it’s not clear that this is for sure what happened.

What tools and techniques do you use to debug a broken/corrupt video file? I’ve been using ffplay and ffprobe, but these seem to think everything is OK. I’ve included diagnostic output below.

This is the ffmpeg on the server that is grabbing the stream from the VBrick appliance:

replay% /opt/bin/ffmpeg -version
ffmpeg version N-62121-g634636e
built on Apr  4 2014 05:34:34 with gcc 4.6 (Debian 4.6.3-1)
configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
libavutil      52. 73.100 / 52. 73.100
libavcodec     55. 56.107 / 55. 56.107
libavformat    55. 36.101 / 55. 36.101
libavdevice    55. 11.100 / 55. 11.100
libavfilter     4.  3.100 /  4.  3.100
libswscale      2.  6.100 /  2.  6.100
libswresample   0. 18.100 /  0. 18.100
libpostproc    52.  3.100 / 52.  3.100

Here’s what ffprobe tells me about the resulting file:

eris:Desktop mpearrow$ ffprobe -v error -show_format -show_streams 2015_04_30_18_30_32344542a3eccfd441677e15496e9e38.mp4
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=40
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
timecode=N/A
refs=4
is_avc=1
nal_length_size=4
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=1252793542
duration=41759.784733
bit_rate=185806
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=1251542
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=245
duration=0.005104
bit_rate=71061942
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=245
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=SoundHandler
[/STREAM]
[FORMAT]
filename=2015_04_30_18_30_32344542a3eccfd441677e15496e9e38.mp4
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=41759.785000
size=984956027
bit_rate=188689
probe_score=100
TAG:major_brand=isom
TAG:minor_version=512
TAG:compatible_brands=isomiso2avc1mp41
TAG:title=\vbStream1S1
TAG:encoder=Lavf55.36.101
[/FORMAT]

When I play the file using ffplayer, this is the console output:

fplay version 2.6.2 Copyright (c) 2003-2015 the FFmpeg developers
  built with Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2015_04_30_18_30_32344542a3eccfd441677e15496e9e38.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : \vbStream1S1
    encoder         : Lavf55.36.101
  Duration: 11:35:59.79, start: 0.000000, bitrate: 188 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 185 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 71061 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Any pointers or suggestions for debugging the video would be greatly appreciated.

Best,

mjp



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2457 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20150626/4b90cd57/attachment.p7s>


More information about the ffmpeg-user mailing list