Closed tonsky closed 5 years ago
Check that videos play on iOS 10 (iPad 4), e.g. https://grumpy.website/post/0S6l7y26Y
They also don't play on iOS 7 when checking them through BrowserStack's emulators. I briefly suspected the possibly too novel DOM API JavaScript around videos (it's assuming classList
for example), but the video won't play when navigating directly to it either (https://grumpy.website/post/0S6l7y26Y/Lj0MhNO.mp4).
This led me to https://stackoverflow.com/questions/21120717/h-264-video-wont-play-on-ios and mediainfo
seems to confirm Grumpy's hosting level 5 videos, outside the ability of older iOSes (see the format line with L5
):
General
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 1.08 MiB
Duration : 13 s 267 ms
Overall bit rate : 686 kb/s
Writing application : Lavf57.82.100
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 13 s 267 ms
Bit rate : 684 kb/s
Width : 1 600 pixels
Height : 1 450 pixels
Display aspect ratio : 1.103
Frame rate mode : Constant
Frame rate : 15.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.020
Stream size : 1.08 MiB (100%)
Writing library : x264 core 148
Encoding settings : 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=18 / lookahead_threads=3 / 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=15 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html backs the level requirement up. I take it it's also dependent on the physical device. I think I saw the videos working on newer iDevices with an even older iOS version — 10.0.0. Given these videos are tiny to begin with, best to pick the oldest profile level possible for the widest audience.
-profile:v main -level:v 3.1
https://superuser.com/questions/563997/how-can-i-set-a-h-264-profile-level-with-ffmpeg
Hey again,
Did something change in the video encoding lately, @tonsky? I noticed the video on https://grumpy.website/post/0WTyncv9j has reverted back to format profile "High@L5", which doesn't work on iPad 4's and such. https://github.com/tonsky/grumpy/blob/5d4876535cd1fd6ab2b5a2c6e21f522a9c3e4e21/src/grumpy/video.clj still references level 3.1, so I'm not sure why https://grumpy.website/post/0WTyncv9j/MnB4F2I.orig.mp4 is level 5. Or could it be a bug as the URL includes "orig", indicating it's the original non-converted video?
The video on https://grumpy.website/post/0WYBkPXDC (even with the .orig
suffix) is properly at level 3.2, so probably something went wrong with the video conversion of https://grumpy.website/post/0WTyncv9j.
The conversion is manual still, I am doing it on my machine, but dmitriid is not. Will get it automated one day...
Ah, hehe, well, that explains the inconsistency. I thought it's part of the site compilation step. Anyways, now you know that https://grumpy.website/post/0WTyncv9j needs re-encoding. :)
Try again
And voila, it works on older iPads, too! Thanks!
ffmpeg -i <input> -c:v libx264 -crf 18 -movflags +faststart -vf "scale=w='min(1000,iw)':h='min(1100,ih)':force_original_aspect_ratio=decrease" -an <output.mp4>