Reputation: 6502
I'm trying to upload a video to a Angular app using ng-file-upload. All works fine until I try and upload a .mp4 video with no audio codec. The video element shows, it shows the correct duration in the control panel, it just doesn't play. Clicking play does nothing, the first frame is not shown.
If I upload any other .mp4 that contains audio the video plays without error.
Below is the information I can see about the file that is failing, as you can see only the video codec is listed for this file.
Here is the 'more info' for another .mp4 file that has audio, this one uploads perfectly fine and plays in the HTML5 video element with no errors.
As you can see, the video that works states the audio codec as AAC, which is expected for .mp4, and shows Audio Channels "2", i'm unsure of the purpose of 'Audio Channels' is in all honesty.
I've been debugging this thing all day and the only difference in files that I can see is in the above images.
Should HTML5 video player play a .mp4 video without any audio codec listed?
What leads me to think the audio has a role to play in this is w3schools description of an Mpeg-4 file:
MP4 = MPEG 4 files with H264 video codec and AAC audio codec
Has anyone had this issue before?
Edit
After adding a listener to the error event on the video I can see that I get a MediaError object with code 3 as a value, so this is a decoding issue I can see.
Screenshot below
Further edit
I've now debugged this as far as going into Chromes 'media-internals' logs. The error Chrome is encountering is now confirmed to be because of the missing audio, see the screenshot below:
Unsure why an error isn't clearly thrown because of this. Is this the end of the line, it's weird because if I upload the video to Facebook it uploads just fine.
Upvotes: 2
Views: 3214
Reputation: 1376
I'd advice you to check if the .mp4 file is properly converted. I've already checked it on my computer and it should be normally played - just video with no audio (Ubuntu 14.04, Chrome 51.0.2704.106).
Use ffmpeg to check the available media tracks:
ffmpeg -i input_file.mp4
Then try to use the source with audio track and convert it to one without an audio. This command will remove all audio tracks:
ffmpeg -i input_file.mp4 -vcodec copy -an output_file.mp4
HTML5 specification doesn't tell what should happen when we don't have a proper codec for one of the media tracks. Just for reference - HTML5
It's always a good idea to check the playback on any other player, VLC is a good one for reference.
Upvotes: 0