[FFmpeg-user] Convert a frame to anything readable

Constantine Hi-Angel at yandex.ru
Tue Nov 7 07:33:57 EET 2017


I have a completely broken AVI file that I'd like to restore. It is so bad 
that apps like DivFix++ don't recognize it. Reading AVI specs gave me a hint 
that with little heuristics I could extract a frame (FTR: they're stored in 
chunks starting with FourCC, then size of the chunk, then the data). But 
what's next?

After some googling, I took for experiments a random valid AVI file, and 
extracted one video frame through radare2. For starters, I'm trying to convert 
it to jpeg, but I probably do something wrong. Below is the output of ffprobe 
run on the avi and ffmpeg run on its frame, any ideas?

    $ ffprobe 1.avi
    ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
      built with gcc 7.2.0 (GCC)
      configuration: --prefix=/usr --disable-debug --disable-static --disable-
stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-
gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-
libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-
libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb 
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-
libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora 
--enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --
enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-
libxvid --enable-shared --enable-version3
      libavutil      55. 78.100 / 55. 78.100
      libavcodec     57.107.100 / 57.107.100
      libavformat    57. 83.100 / 57. 83.100
      libavdevice    57. 10.100 / 57. 10.100
      libavfilter     6.107.100 /  6.107.100
      libavresample   3.  7.  0 /  3.  7.  0
      libswscale      4.  8.100 /  4.  8.100
      libswresample   2.  9.100 /  2.  9.100
      libpostproc    54.  7.100 / 54.  7.100
    Input #0, avi, from '1.avi':
      Metadata:
        encoder         : Lavf57.83.100
      Duration: 00:00:45.03, start: 0.000000, bitrate: 539 kb/s
        Stream #0:0: Video: vp8 (VP80 / 0x30385056), yuv420p(progressive), 
480x640, 527 kb/s, SAR 1:1 DAR 3:4, 60 fps, 60 tbr, 60 tbn, 60 tbc

    $ ffmpeg -f rawvideo -s 480x640 -pix_fmt yuv420p -vcodec vp8 -i frame 
out.jpg
    ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 7.2.0 (GCC)
      configuration: --prefix=/usr --disable-debug --disable-static --disable-
stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-
gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-
libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-
libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb 
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-
libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora 
--enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --
enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-
libxvid --enable-shared --enable-version3
      libavutil      55. 78.100 / 55. 78.100
      libavcodec     57.107.100 / 57.107.100
      libavformat    57. 83.100 / 57. 83.100
      libavdevice    57. 10.100 / 57. 10.100
      libavfilter     6.107.100 /  6.107.100
      libavresample   3.  7.  0 /  3.  7.  0
      libswscale      4.  8.100 /  4.  8.100
      libswresample   2.  9.100 /  2.  9.100
      libpostproc    54.  7.100 / 54.  7.100
    [rawvideo @ 0x55c1ee9c9760] Estimating duration from bitrate, this may be 
inaccurate
    Input #0, rawvideo, from 'frame':
      Duration: N/A, start: 0.000000, bitrate: 92160 kb/s
        Stream #0:0: Video: vp8, yuv420p, 480x640, 92160 kb/s, 25 tbr, 25 tbn, 
25 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (vp8 (native) -> mjpeg (native))
    Press [q] to stop, [?] for help
    [vp8 @ 0x55c1ee9e05e0] Discarding interframe without a prior keyframe!
    Error while decoding stream #0:0: Invalid data found when processing input
    Finishing stream 0:0 without any data written to it.
    [swscaler @ 0x55c1ee9f2f40] deprecated pixel format used, make sure you 
did set range correctly
    Output #0, image2, to 'out.jpg':
      Metadata:
        encoder         : Lavf57.83.100
        Stream #0:0: Video: mjpeg, yuvj420p(pc), 480x640, q=2-31, 200 kb/s, 25 
fps, 25 tbn, 25 tbc
        Metadata:
          encoder         : Lavc57.107.100 mjpeg
        Side data:
          cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   
0x    
    video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: unknown
    Output file is empty, nothing was encoded (check -ss / -t / -frames 
parameters if used)
    Conversion failed!


More information about the ffmpeg-user mailing list