[FFmpeg-user] Reordering frames in corrupt GoPro videos

Vincent Deconinck vdeconinck at gmail.com
Fri Jul 19 00:56:51 EEST 2024


On Thu, Jul 18, 2024 at 12:26 AM Mark Filipak <markfilipak.imdb at gmail.com>
wrote:

> Have you tried appealing to the manufacturer for a repair?
>

Well, the camera is a GoPro Hero8, it's out of warranty and basically
outdated so I doubt they do anything except charge me for more than the
price of a brand new one.

[Off-topic]Action cameras are designed with water and snow in mind, so they
are extremely compact and watertight, which makes them prone to overheating
(a search for "gopro overheat" returns thousands of results). Now put one
of those Hero 8 /Black/ behind a windscreen with some sunlight and it
overheats in 5 minutes. Several times instead of shutting down it hung
burning CPU cycles and getting hotter and hotter, to the point it swelled
several batteries. The only way I found to keep it cool was to use it
powered via USB, remove the battery, remove the battery cover, wrap it in
white plastic stick a CPU heatsink against the screen and redirect an air
vent to the it:
https://photos.app.goo.gl/vNinJDpGWX7KAkqQ7
https://photos.app.goo.gl/ifY7oNeFyrSbe4j69
I can't say for sure the corrupted files are due to overheating, but with
the above setup it never happened for 2 years. Then it began to occur
randomly, rarely at first. But during my last trip around one third of the
footage was corrupt :-(
So I bought a new action camera now (needless to say it's not a GoPro
anymore) but I'd like to recover the corrupt footage... Anyway.
[/offtopic]


Based on a recent tip, try this command:
> ffprobe -flags2 +showall -i ...
>
> You may find that what you think is the first frame is not always the
> first frame.
>

Thanks.
I tried the above command but it reports some compatibility issues:

ffprobe -flags2 +showall -i in_bad_frame_order.mp4
ffprobe version 7.0.1-full_build-www.gyan.dev Copyright (c) 2007-2024 the
FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-w32threads --disable-autodetect --enable-fontconfig
--enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib
--enable-lzma --enable-libsnappy --enable-zlib --enable-librist
--enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth
--enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24
--enable-libaribcaption --enable-libdav1d --enable-libdavs2
--enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e
--enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom
--enable-libjxl --enable-libopenjpeg --enable-libvpx
--enable-mediafoundation --enable-libass --enable-frei0r
--enable-libfreetype --enable-libfribidi --enable-libharfbuzz
--enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg
--enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2
--enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl
--enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc
--enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio
--enable-libgme --enable-libmodplug --enable-libopenmpt
--enable-libopencore-amrwb --enable-libmp3lame --enable-libshine
--enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc
--enable-libcodec2 --enable-libilbc --enable-libgsm
--enable-libopencore-amrnb --enable-libopus --enable-libspeex
--enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite
--enable-libmysofa --enable-librubberband --enable-libsoxr
--enable-chromaprint
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000288169e7940] All samples in data stream
index:id [4:5] have zero duration, stream set to be discarded by default.
Override using AVStream->discard or -discard for ffmpeg command.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in_bad_frame_order.mp4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2024-05-11T15:45:07.000000Z
    firmware        : HD8.01.02.51.00
  Duration: 00:05:57.72, start: 0.000000, bitrate: 45211 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668),
yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 44952 kb/s, 29.97 fps,
29.97 tbr, 90k tbn (default)
      Metadata:
        creation_time   : 2024-05-11T15:45:07.000000Z
        handler_name    : GoPro H.265
        vendor_id       : [0][0][0][0]
        encoder         : GoPro H.265 encoder
        timecode        : 15:55:58:16
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 189 kb/s (default)
      Metadata:
        creation_time   : 2024-05-11T15:45:07.000000Z
        handler_name    : GoPro AAC
        vendor_id       : [0][0][0][0]
        timecode        : 15:55:58:16
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74) (default)
      Metadata:
        creation_time   : 2024-05-11T15:45:07.000000Z
        handler_name    : GoPro TCD
        timecode        : 15:55:58:16
  Stream #0:3[0x4](eng): Data: bin_data (gpmd / 0x646D7067), 52 kb/s
(default)
      Metadata:
        creation_time   : 2024-05-11T15:45:07.000000Z
        handler_name    : GoPro MET
  Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 9 kb/s (default)
      Metadata:
        creation_time   : 2024-05-11T15:45:07.000000Z
        handler_name    : GoPro SOS
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 98314 for input stream 3
Unsupported codec with id 0 for input stream 4

Apart from several GoPro streams, I don't see anything pertaining to frame
order.
Now admittedly I don't really know what I'm looking for ;-)

Kind regards,

Vincent


More information about the ffmpeg-user mailing list