0
For some background, I'm making a webpage which adjusts the playback position in an embedded video when the user scrolls, so if you scroll down, the video will advance and vice versa. This works perfectly with one video file, but lags unbearably on another. It should be noted that I don't care about audio, it would be best if the files had none, in fact.
I don't know all that much about video formats, but I've learnt a lot in the last few hours!
So, this is the working video file:
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
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, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.11.101
Duration: 00:00:20.38, start: 0.000000, bitrate: 5367 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5199 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
timecode : 00:00:00:00
Stream #0:1(eng): Data: none (rtp / 0x20707472), 164 kb/s
Metadata:
handler_name : HintHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : TimeCodeHandler
timecode : 00:00:00:00
And here is the one which is lagging:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video2.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isomiso2avc1mp41mp42
encoder : Lavf57.25.100
Duration: 00:00:19.20, start: 0.000000, bitrate: 7435 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 7206 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Data: none (rtp / 0x20707472), 225 kb/s (default)
Metadata:
creation_time : 2018-07-22T22:58:04.000000Z
handler_name : GPAC ISO Hint Handler
As you can see in the second one, I've attempted to add a hint stream (via encoding.com) to improve the responsiveness of the playback as I've read it helps, but to no avail.
I'm wondering if some kind folks can help me work out the difference between the two files, so I can make it work nicely with both. Thanks!
EDIT
Here are the outputs of ffmpeg -i <file>.mp4 -f null -
as asked for in comments:
And here are the logs from ffmpeg -discard nokey -copyts -i <file>.mp4 -vf showinfo -f null -
:
Can you explain more clearly what you mean? Is “scrub” standard videographer terminology? I’m not a videographer; I don’t understand what you’re asking for. Please do not respond in comments; [edit] your question to make it clearer and more complete. – Scott – 2018-07-22T23:59:10.643
@Scott hope that helps - I think scrub is correct terminology for advancing through a video, but I'm not 100% sure. – developius – 2018-07-23T00:41:17.227
What's the frame count for each file when you run
ffmpeg -i in.mp4 -f null -
? – Gyan – 2018-07-23T05:03:44.890@Gyan as above, they're 24 (working) and 25 (not working) respectively. I've tried decreasing the latter to no avail. – developius – 2018-07-23T21:06:20.007
I don't want the framerate. Please run the command and provide the frame count. – Gyan – 2018-07-24T04:47:08.177
@Gyan sorry, misread your comment. I've run that for both files but neither appear to have the frame count in the output. – developius – 2018-07-24T21:46:53.153
Share full log. – Gyan – 2018-07-25T05:31:39.630
Ok. Framerate appears to be constant. Now, logs of
ffmpeg -discard nokey -copyts -i in.mp4 -vf showinfo -f null -
– Gyan – 2018-07-26T04:56:50.340