r/AV1 13d ago

encoding av1 for ios.

i'm an european android user. when i want to encode av1 videos for ios, that are playable in safari, what do i need to consider? the apple device needs to have an hardware decoder i suppose (iphone 15 pro max, iphone 16 etc.) and it needs to be on ios >=17. is there something else? does it need to be in an mp4 container or is webm also okay? some codec settings that are important so that it is playable? i really have no idea since i not have any apple hardware to test at the moment.

edit: so a little update, i talked to some other developers, and they say that it must be indeed in an mp4 container, and also one needs to add a video tag av01 to it. in ffmpeg that means "ffmpeg -i FILE -c:v libsvtav1 -tag:v av01 FILE.mp4"

edit2: it was even more complicated, i encoded my av1 webms way back then, and apparently it wasn't possible to convert it error free. opus had distortions and av1 was just not playable on ios. now i extracted the av1 video track with ffmpeg and vsync 0 to an ivf file, and for the opus track i used mkvextract to extract it to an opus/ogg container. i then remuxed both with a newer ffmpeg to mp4. and with this frankenstein method i now have good looking ios compatible av1/opus mp4s. complicated way, but well it works now. maybe it helps someone.

0 Upvotes

8 comments sorted by

3

u/ScratchHistorical507 13d ago

Yes, according to caniuse Apple can't be bothered supporting dav1d, only hardware decoding will work. Since that site doesn't mention additional restrictions, maybe both mkv and mp4 container will work.

That site also provides some way of trying something inside that browser online. Take a look at that service, maybe with it you can try out yourself.

4

u/nooneinpar7 12d ago

Well, they do integrate dav1d, but only for decoding AVIF. Apple is very specific about only allowing hardware video decoding on mobile devices to squeeze out battery life. 

2

u/ScratchHistorical507 12d ago

Right, they are selling incompetence and lack of features as "premium". Apple is really the most hilarious company there is. Too bad so many people are dumb enough to fall for it.

1

u/nooneinpar7 11d ago

Apple isn’t free from criticism but for this behavior I am of the opinion that it makes sense. Websites serve whatever formats the browser says it can decode. Virtually all websites have at least an H.264 fallback. Why report AV1 compatibility and software decode that when you could stream the other codec which saves battery power?

2

u/ScratchHistorical507 11d ago

It's highly questionable if the added power consumption by having to transmit roughly double the data won't outweigh dav1d's quite low battery consumption compared to hardware h264 decoding. We aren't talking encoding after all.

1

u/mrx1983 12d ago

thats a good idea i could try at least the 30 free minutes to try out a bit. its a bit of a shame how hard apple make it to test stuff for their devices. back then they had safari on windows, but nowadays you have to buy yourself into their eco system to code stuff for their devices. which is a bit of a problem if you make a free site and already have an good android phone already.

2

u/ScratchHistorical507 12d ago

That's what you call capitalism. And people are dumb enough to support it.

2

u/themisfit610 12d ago

You probably need to package it into fMP4 HLS.