-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple iDevices do not display mp4 videos when served without special treatment #304
Comments
Hi @Laurent3170,
As I'm not an expert on iOS formats, I don't know any specific configuration for these devices. |
Hi @Romain, thanks for your answer. |
Do you know where I can find help ? I don't think I'm alone to have the need to have videos viewable on iDevices ;-) |
I'm unsure. |
Thanks. The thing is that I don't know what my command line should look like... But I'll make investigations. |
I have found https://korben.info/ffmpeg-pour-les-nuls.html (in french) that specifies the command line for iPhone |
Hi @Laurent3170, |
I've made some tests. By using |
May I create a PR? I'd searched after this, but didn't found anything. |
The function is present in the DefaultVideo class, but that's right, not in the H264 one. |
@Romain But it's used in the examples? And since it's just extending, why it doesn't inherit these functions? https://github.com/PHP-FFMpeg/PHP-FFMpeg#transcoding |
@jens1o You're right, I answered a bit fast.
No need to recreate one. The example is valid. When @Laurent3170 says:
This is not related to the bundle but to FFMPEG itself. I think you should make sure your version of FFMPEG is working properly, @Laurent3170 . |
I have updated to I have also tried
But I receive this error message |
@Laurent3170, the setKiloBitrate function must be applied on a format, not on the video... ;) |
Ah... It works better like this! I still can't read the video on iDevices, but now I can search and "play" with data. I'll let you know. |
Hehe, sure it's better... ;o) |
So, I'm still fighting with videos... |
Hi @Laurent3170, |
I asked @FranckHAEGELI, who thinks that it may come from number of frame per seconds (30 when iOS only accept 23,976 , 25 or 29,97, but it's not sure that this is the problem... |
Thanks for the search. Unfortunately it doesn't work. My framerate was 24. I have tested with 23,976, 25 and 29,97, but it's the same, I can't read on a iPhone. I think it's related to the sound codec, but apart with VLC, I don't know how to have all the encoding's details of a video, to check the difference between the two videos I've cited above. I've googled a while ago but it was not giving a "good" result, I'll try again later. |
I've found mediainfo which gave me information about the two video above that I have compared. Here is the result (just the meaningful differences): Video Ok = not encoded via this library
Result So, the main thing is that the video seems to be NOT streamable which may explain why I can't read, and the other about the Codec don't talk to me. |
This definitely looks like an encoding problem. |
I think I'd might got it. https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility Use simple filters to get what you want 😉 But I'm already making a pr for this. |
Really thanks for your work!
I have also tried
But then I obtain this error (but here it may be due to a bad copy/paste, event if I've checked)
|
Oh. Thanks for searching this, there is a mistake... You'd found a bug! |
Finding a bug (without knowing it) is not the main part of the problem ;-) |
@Laurent3170 could you paste here the complete logs so we can figure out where the error resides? |
@Romain The only logs I can produce are the ones produced by the |
Ok, I misunderstood your previous message, you already pasted the logs you had. Can you confirm that you're using your PR to do this: $format
->setProfile(Profile::HIGH)
->setLevel(4.1); ? Why is $format NULL? Haven't you this before? |
@Romain Yes I have copied/pasted the changes from #335 on my computer and then run the script. |
The changes were just about the test. So the result is still the same for me, not being displayed oniPhone 4s and |
You must create format first then set level and profile last. Also i use baseline and level 3.0 |
Yes, I do
But like this I have an error |
he uses baseline and level 3.0, you're using profile high and level 4.1 |
Yes this was due to a bad copy/paste from the code above. But I have tried with baseline and 3.0, the $format is not null so this error has disappeared :-) the video is well encoded, but I still can't read the video https://edlo.eu/6gkfwk/img/video.mp4. |
Any news ? I've tried with an iPhone 6 and still the video is not readable... |
I'm afraid, but I do not have any experiences with iOS. :/ |
I resolved this issue. I have attached the code for you.
|
@discoveryjames thanks for your answer but what is the value of |
I would also recommend using the faststart flag too, so that the whole file doesn't have to download before it starts playing.
|
Thanks for that adding (didn't know about faststart) but what about |
Sorry for the confusion. I have rewritten the code anyway, I'm using the line below. This is using a php7 array, but if you're not using php7 you can just use array() instead of []
|
So, I have tried using your code but I have an encoding failed error
So, I have also tried with
This one works and is currently in https://edlo.eu/6gkfwk/img/video.mp4, but it doesn't display on my iPhone 6... But well displayed on Firefox. |
Did you find a way to encode your videos for iOS support ? I absolutly need it. Thanks ! |
No I didn't find a way... |
I got it working using the following
|
Thanks for your answer! I have tried (after a long-time not working on the project) and I can display it on iPhone! The settings are the same as the ones I've tried with in August 2017, but now it works. But maybe it was already the case in 2017, because (today) I saw that when I access the file directly, I can see it, but when I use a Symfony controller that return the file content + mime type it doesn't show, so maybe the problem was from here... I don't know. |
So it's confirmed... The problem was not only with the settings of the saved video but also with the Response sent by Symfony (in fact even with PHP directly it doesn't work). We still have to use special settings to format videos for iDevices. |
updated the title for more clarity |
still actual :) |
@atastycookie could you open a new issue for you own one? |
According to http://www.iphonefaq.org/archives/97961 (I've also found this information in other places) videos have to be encoded with H.264 video up to 720p, 30 fps and audio: AAC-LC up to 160 Kbps, 48kHz, stereo, to be viewable from iDevices.
When I encode the video using
x264
+libfdk_aac
and gets information from VLC, I have for audioMPEG AAC Audio (mp4a) / 44100 Hz / 16 bits / 1411 kbit/s
.It seems that
MPEG AAC
andAAC-LC
are the same but it looks like the KiloBitrate is too much.I've found an option to set it when saving only the audio, but can't find one when saving the video.
Is there one ?
Is there a specific configuration to be able to save video to be viewable from iDevices ?
Thanks
The text was updated successfully, but these errors were encountered: