Skip to content

Instantly share code, notes, and snippets.

@SebiderSushi
Last active February 10, 2021 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SebiderSushi/be89ede578881f22c66d667e717c9859 to your computer and use it in GitHub Desktop.
Save SebiderSushi/be89ede578881f22c66d667e717c9859 to your computer and use it in GitHub Desktop.
Explanation on fixing these indeo3 videos

The main issue seems to be the "invalid picture dimension"

[indeo3 @ 0x55a6eb70b480] Invalid picture dimensions: 182 x 182!

As can be seen at https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/indeo3.c#L174 ffmpeg wants the dimensions to be divisible by 8:

    if (luma_width  < 16 || luma_width  > 640 ||
        luma_height < 16 || luma_height > 480 ||
        luma_width  &  3 || luma_height &   3) {
        av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n",
               luma_width, luma_height);
        return AVERROR_INVALIDDATA;
    }

If we remove this constraint from the if statement and recompile ffmpeg it seems to convert your sample videos just fine. The if statement should look like this:

    if (luma_width  < 16 || luma_width  > 640 ||
        luma_height < 16 || luma_height > 480) {
        av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n",
               luma_width, luma_height);
        return AVERROR_INVALIDDATA;
    }

When compiling, be sure to enable the encoders you need. For example, h264 must explicitly be enabled and one way as per man ffmpeg-codecs is as follows:

   libx264, libx264rgb
       x264 H.264/MPEG-4 AVC encoder wrapper.

       This encoder requires the presence of the libx264 headers and library during configuration. You
       need to explicitly configure the build with "--enable-libx264".

So you'll have to run your ./configure as ./configure --enable-gpl --enable-libx264 before compiling FFmpeg with make.

This is how i converted the files

According to x264 --fullhelp, -qp 0 should produce lossless encoding:

Ratecontrol:

  -q, --qp <integer>          Force constant QP (0-81, 0=lossless)
  -B, --bitrate <integer>     Set bitrate (kbit/s)

So here goes:

~/Development/ffmpeg/ffmpeg -y -i 70_1.mp4 -map 0:0 -c libx264 -qp 0 70_1_fixed.mp4
~/Development/ffmpeg/ffmpeg -y -i 95_1.mp4 -map 0:0 -c libx264 -qp 0 95_1_fixed.mp4

During this ffmpeg adjusted the image dimensions to be divisible by 8 so the results of this conversion should cause no further problems.

[sebi@manjaro Downloads]$ ffmpeg -i 70_1.mp4 -c:a copy -c:v h264 uwu.mkv
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[indeo3 @ 0x556b2bc065c0] Invalid picture dimensions: 182 x 182!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x556b2bc04780] Failed to open codec in avformat_find_stream_info
[indeo3 @ 0x556b2bc065c0] Invalid picture dimensions: 182 x 182!
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '70_1.mp4':
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
Duration: 00:00:21.83, start: 0.000000, bitrate: 1260 kb/s
Stream #0:0(eng): Video: indeo3 (IV32 / 0x32335649), yuv410p, 182x182, 906 kb/s, 12 fps, 12 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
handler_name : Apple Video Media Handler
encoder : Intel Indeo™ Video R3.2
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 22050 Hz, mono, s16, 352 kb/s (default)
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
handler_name : Apple Sound Media Handler
[indeo3 @ 0x556b2bc2be80] Invalid picture dimensions: 182 x 182!
Stream mapping:
Stream #0:0 -> #0:0 (indeo3 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Error while opening decoder for input stream #0:0 : Invalid data found when processing input
[sebi@manjaro videoshite]$ ~/Development/ffmpeg/ffmpeg -y -i 70_1.mp4 -map 0:0 -c libx264 -qp 0 70_1_fixed.mp4
ffmpeg version N-101018-gd4e837a8ee Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (GCC)
configuration: --enable-libx264 --enable-gpl --enable-libvpx
libavutil 56. 64.100 / 56. 64.100
libavcodec 58.121.100 / 58.121.100
libavformat 58. 67.100 / 58. 67.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7.103.100 / 7.103.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '70_1.mp4':
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
Duration: 00:00:21.83, start: 0.000000, bitrate: 1260 kb/s
Stream #0:0(eng): Video: indeo3 (IV32 / 0x32335649), yuv410p, 182x182, 906 kb/s, 12 fps, 12 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
handler_name : Apple Video Media Handler
vendor_id : intl
encoder : Intel Indeo™ Video R3.2
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 22050 Hz, mono, s16, 352 kb/s (default)
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
handler_name : Apple Sound Media Handler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (indeo3 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x564603888f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x564603888f80] profile High 4:4:4 Predictive, level 1.1, 4:2:0, 8-bit
[libx264 @ 0x564603888f80] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=12 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to '70_1_fixed.mp4':
Metadata:
encoder : Lavf58.67.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 184x184, q=2-31, 12 fps, 12288 tbn (default)
Metadata:
creation_time : 1996-12-07T13:23:58.000000Z
handler_name : Apple Video Media Handler
vendor_id : intl
encoder : Lavc58.121.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 262 fps=0.0 q=-1.0 Lsize= 4248kB time=00:00:21.75 bitrate=1599.9kbits/s speed=26.1x
video:4246kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.045082%
[libx264 @ 0x564603888f80] frame I:2 Avg QP: 0.00 size: 17449
[libx264 @ 0x564603888f80] frame P:260 Avg QP: 0.00 size: 16586
[libx264 @ 0x564603888f80] mb I I16..4: 34.7% 0.7% 64.6%
[libx264 @ 0x564603888f80] mb P I16..4: 0.7% 1.4% 9.6% P16..4: 41.3% 18.1% 15.7% 0.0% 0.0% skip:13.1%
[libx264 @ 0x564603888f80] 8x8 transform intra:11.4% inter:32.2%
[libx264 @ 0x564603888f80] coded y,uvDC,uvAC intra: 96.2% 96.4% 96.4% inter: 66.5% 80.2% 79.7%
[libx264 @ 0x564603888f80] i16 v,h,dc,p: 91% 6% 3% 0%
[libx264 @ 0x564603888f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 58% 38% 2% 1% 0% 0% 0% 0% 1%
[libx264 @ 0x564603888f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 57% 27% 3% 2% 2% 1% 2% 2% 3%
[libx264 @ 0x564603888f80] i8c dc,h,v,p: 5% 49% 47% 0%
[libx264 @ 0x564603888f80] Weighted P-Frames: Y:0.4% UV:0.4%
[libx264 @ 0x564603888f80] ref P L0: 66.8% 6.6% 23.0% 3.5% 0.0%
[libx264 @ 0x564603888f80] kb/s:1592.84
[sebi@manjaro videoshite]$ ~/Development/ffmpeg/ffmpeg -y -i 95_1.mp4 -map 0:0 -c libx264 -qp 0 95_1_fixed.mp4
ffmpeg version N-101018-gd4e837a8ee Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (GCC)
configuration: --enable-libx264 --enable-gpl --enable-libvpx
libavutil 56. 64.100 / 56. 64.100
libavcodec 58.121.100 / 58.121.100
libavformat 58. 67.100 / 58. 67.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7.103.100 / 7.103.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '95_1.mp4':
Metadata:
creation_time : 1996-12-06T10:27:04.000000Z
Duration: 00:01:01.67, start: 0.000000, bitrate: 1398 kb/s
Stream #0:0(eng): Video: indeo3 (IV32 / 0x32335649), yuv410p, 312x203, 1044 kb/s, 12 fps, 12 tbr, 12 tbn, 12 tbc (default)
Metadata:
creation_time : 1996-12-06T10:27:04.000000Z
handler_name : Apple Video Media Handler
vendor_id : intl
encoder : Intel Indeo™ Video R3.2
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 22050 Hz, mono, s16, 352 kb/s (default)
Metadata:
creation_time : 1996-12-06T10:27:04.000000Z
handler_name : Apple Sound Media Handler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (indeo3 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x5597b33e9780] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x5597b33e9780] profile High 4:4:4 Predictive, level 1.2, 4:2:0, 8-bit
[libx264 @ 0x5597b33e9780] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=12 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to '95_1_fixed.mp4':
Metadata:
encoder : Lavf58.67.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 312x204, q=2-31, 12 fps, 12288 tbn (default)
Metadata:
creation_time : 1996-12-06T10:27:04.000000Z
handler_name : Apple Video Media Handler
vendor_id : intl
encoder : Lavc58.121.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 740 fps=186 q=-1.0 Lsize= 21019kB time=00:01:01.58 bitrate=2796.0kbits/s speed=15.5x
video:21015kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019276%
[libx264 @ 0x5597b33e9780] frame I:8 Avg QP: 0.00 size: 34502
[libx264 @ 0x5597b33e9780] frame P:732 Avg QP: 0.00 size: 29020
[libx264 @ 0x5597b33e9780] mb I I16..4: 35.7% 1.7% 62.5%
[libx264 @ 0x5597b33e9780] mb P I16..4: 7.4% 1.7% 20.5% P16..4: 35.3% 16.9% 14.1% 0.0% 0.0% skip: 4.0%
[libx264 @ 0x5597b33e9780] 8x8 transform intra:5.6% inter:15.1%
[libx264 @ 0x5597b33e9780] coded y,uvDC,uvAC intra: 96.5% 98.8% 98.7% inter: 62.0% 87.3% 87.0%
[libx264 @ 0x5597b33e9780] i16 v,h,dc,p: 34% 65% 0% 0%
[libx264 @ 0x5597b33e9780] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 54% 1% 1% 0% 0% 0% 0% 1%
[libx264 @ 0x5597b33e9780] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 49% 35% 2% 3% 2% 2% 2% 2% 3%
[libx264 @ 0x5597b33e9780] i8c dc,h,v,p: 2% 52% 46% 0%
[libx264 @ 0x5597b33e9780] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x5597b33e9780] ref P L0: 69.9% 3.7% 22.7% 3.7%
[libx264 @ 0x5597b33e9780] kb/s:2791.57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment