muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.72k stars 3.95k forks source link

webm on mobileSafari #202

Open doubletaketech opened 10 years ago

doubletaketech commented 10 years ago

muaz, unfortunately the webm video doesn't play on iOS. Do you have an option that encodes it to something that will?

I'm also looking into options for uploading the webm to youtube or vimeo so they can convert it. It would be a cool example for you to add "Record and Post to YouTube"

Thanks, Don

muaz-khan commented 10 years ago

According to caniuse page, iOS safari isn't supporting WebM yet. Though, I added demos for transcoding in mpeg/mp4; however not all Mp4 encoding formats are supported by iPhone. Please check this post.

A quote from: http://stackoverflow.com/a/4797628/552182

After turning on the safari console on the iPad, we saw that when trying to load the video we were getting a "byte_range_error_message" being logged. It seems the mobile devices request this content differently than desktop devices, by requesting certain bytes at a time. We managed to find out that the video played fine when the phones used their 3G networks, but not when they loaded the video through the internal wifi. A lot of research later led us to this MSDN article: http://support.microsoft.com/kb/922330

Which explained how to find the setting in our firewall to allow the devices to request the video properly. We also found a similar setting on one of our D-Link routers for a separate wifi network that was also having the problem.

900kbps seems a good max-bitrate limit to make resulting videos works on iOS; RecordRTC uses 60kbps.

Default resolutions used by RecordRTC is 320*240 and 640*480 is considered a good max-resolutions for iOS videos.

RecordRTC is also using 30fps.

To convert from WebM to mp4, I'm using following ffmpeg command:

ffmpeg -i video.webm -c:v mpeg4 -b:v 64k -strict experimental output.mp4

I'm setting mp4 file's bitrates to 64k; you can use maximum suggested value i.e. 900k.

I'm also looking into options for uploading the webm to youtube or vimeo so they can convert it. It would be a cool example for you to add "Record and Post to YouTube"

Vimeo-Group page has the answer.

Vimeo's POST uploading (https://developer.vimeo.com/api/upload#http-post-uploading) actually gives you all the information you need.

The new API uses OAuth 2, so you need to use that to authenticate, and then make an HTTP POST request to /me/videos. These steps should be performed on the server. The response from the POST to /me/videos will be an upload ticket. This contains an html form which you can give to your users, or a field called "upload_link_secure" which you can provide to your jQuery methods. These can all be performed on the client side.

Make sure not to include your access token in the client! Only the response from the POST request is safe to transmit to your client.

I'll try to add Record video using RecordRTC and Post to YouTube/Vimeo demo very soon.

For uploading to youtube; following page may help: