Someone has sent me a video that I wish to embed into a presentation I'm building. However, it doesn't play back as the author intended either embedded or standalone. I suspect was encoded on a Mac, but not sure at the present time what tool was used - still looking into that information...
I discovered that the video plays fine in Windows Quicktime v7.7.9, but using VLC v3.0.16 and Windows Media Players, and K-Lite Media Player Classic, it does not. Depends which player what happens, but VLC shows an out-of-sequence frame for about 10s, then the frames from the first part, then seems to hang video playback. WMP plays the audio out of sync with the video.
I should add, this is a recording of someone speaking over a slide deck, and a lot of the video frames are the same - it doesn't have a talking head in the corner or anything. I think that might account for the surprisingly low frame rate - there aren't a lot of different frames.
I've tried a few attempts at re-encoding using FFmpeg, but to no avail. I'm wondering what more information I can extract to help diagnose the issue. Meanwhile, am trying to get the author to produce an alternative export in case that helps...
MediaInfo reports:
General
CompleteName : C:\work\video\input.mp4
Format/String : MPEG-4
Format_Profile : Base Media / Version 2
CodecID/String : mp42 (isom/mp41/mp42)
FileSize/String : 10.0 MiB
Duration/String : 8 min 54 s
OverallBitRate_Mode/String : Variable
OverallBitRate/String : 157 kb/s
Encoded_Date : UTC 2021-11-24 19:15:52
Tagged_Date : UTC 2021-11-24 19:15:52
Video
ID/String : 2
Format/String : AVC
Format/Info : Advanced Video Codec
Format_Profile : High@L4
Format_Settings : CABAC / 2 Ref Frames
Format_Settings_CABAC/String : Yes
Format_Settings_RefFrames/String : 2 frames
CodecID : avc1
CodecID/Info : Advanced Video Coding
Duration/String : 8 min 54 s
Source_Duration/String : 10 min 4 s
BitRate_Mode/String : Variable
BitRate/String : 26.9 kb/s
BitRate_Maximum/String : 768 kb/s
Width/String : 1 920 pixels
Height/String : 1 080 pixels
DisplayAspectRatio/String : 16:9
FrameRate_Mode/String : Variable
FrameRate/String : 0.046 FPS
FrameRate_Minimum/String : 0.010 FPS
FrameRate_Maximum/String : 5.000 FPS
ColorSpace : YUV
ChromaSubsampling/String : 4:2:0
BitDepth/String : 8 bits
ScanType/String : Progressive
Bits-(Pixel*Frame) : 0.282
StreamSize/String : 1.88 MiB (19%)
Source_StreamSize/String : 2.01 MiB (20%)
Title : Core Media Video
Encoded_Date : UTC 2021-11-24 19:15:52
Tagged_Date : UTC 2021-11-24 19:15:52
CodecConfigurationBox : avcC
Audio
ID/String : 1
Format/String : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
CodecID : mp4a-40-2
Duration/String : 8 min 54 s
Source_Duration/String : 8 min 54 s
BitRate_Mode/String : Constant
BitRate/String : 128 kb/s
Channel(s)/String : 1 channel
ChannelLayout : C
SamplingRate/String : 44.1 kHz
FrameRate/String : 43.066 FPS (1024 SPF)
Compression_Mode/String : Lossy
StreamSize/String : 7.91 MiB (79%)
Source_StreamSize/String : 7.91 MiB (79%)
Title : Core Media Audio
Encoded_Date : UTC 2021-11-24 19:15:52
Tagged_Date : UTC 2021-11-24 19:15:52
Based on the comments below that the low framerate could be confusing the players, I tried a couple of options that I thought might interpolate to produce a more "expected" output framerate:
ffmpeg -i input.mp4 -crf 10 -filter:v tblend -r 24 output.24fps.mp4
ffmpeg -i input.mp4 -filter:v "minterpolate=mi_mode=dup" output.mp4
In both cases, this results in a video where the first slide of the deck is dropped - so it starts with slide 2 then the audio is out of sync thereafter. There's a hint that an issue reported in the ffmpeg output may be related:
c:\work\video>ffmpeg -y -i input.mp4 -crf 10 -filter:v tblend -r 24 output.24fps.mp4
ffmpeg version 4.4.1-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.2.0 (Rev1, 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-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000168edd2b740] decoding for stream 1 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41mp42
creation_time : 2021-11-24T19:15:52.000000Z
Duration: 00:08:54.25, start: 0.000000, bitrate: 157 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 124 kb/s (default)
Metadata:
creation_time : 2021-11-24T19:15:52.000000Z
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 27 kb/s, 0.05 fps, 100 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2021-11-24T19:15:52.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 00000168ee7bf380] using SAR=1/1
[libx264 @ 00000168ee7bf380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000168ee7bf380] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 00000168ee7bf380] 264 - core 164 r3075 66a5bc1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.24fps.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41mp42
encoder : Lavf58.76.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 12288 tbn (default)
Metadata:
creation_time : 2021-11-24T19:15:52.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
creation_time : 2021-11-24T19:15:52.000000Z
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 aac
More than 1000 frames duplicated 1792kB time=00:03:04.85 bitrate= 79.4kbits/s dup=628 drop=0 speed= 30x
frame= 4100 fps=127 q=15.0 size= 5376kB time=00:05:01.51 bitrate= 146.1kbits/s dup=4092 drop=0 speed=9.37x
The output contains the line:
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000168edd2b740] decoding for stream 1 failed
I can set -analyzeduration to a larger figure to get rid of the failure, but I suspect that is masking rather than fixing it.
For further information, according to https://stackoverflow.com/questions/4425413/how-to-extract-the-1st-frame-and-restore-as-an-image-with-ffmpeg/4425466 this should extract the first frame:
ffmpeg -i input.mp4 -vf "select=eq(n\,0)" -vframes 1 out.png
but it provides the second slide in the presentation, when QT clearly shows a first, title slide, on screen for at least 10s...