HTML5 video of type video/mp4 playing audio only

10,109

Turns out the video was not properly encoded to be supported by HTML5 video tag.

HTML5 video requires MP4 videos with H264 video codec and AAC audio codec.

The problem video was not of codec H264. Running it through a converter fixed it.

Share:
10,109
Tester
Author by

Tester

Updated on June 26, 2022

Comments

  • Tester
    Tester almost 2 years

    I have an app built with codeigniter and launched in Facebook. This app should allow users to upload videos of type mp4.

    The videos upload fine. I had set the mime type in mimes.php as 'mp4' => array('video/mp4', 'application/octet-stream').

    I uploaded a video that showed up as type application/octet-stream when I checked with codeigniters file upload class. But I uploaded another video with ext .mp4 and it was uploaded successfully.

    The video that plays fine shows up as type application/octet-stream when I echo the file type, but the video that only plays audio shows up as type video/mp4.

    However when I try to view the video in my interface, using HTML5 video, it plays, but only audio. You can hear the sound as the video plays but I can't see the video itself.

    How do i fix this?

    EDIT:

    The video that plays only sound can be seen here

    You can see the video if you view it on my machine in a video player, but it only plays audio on the web.

    The code that displays the video is

    <video  width="410" controls>
                  <source src=" <?php echo base_url().$upload_path.'/'.$videos_dir.'/'. $item['name'];?>" type="video/mp4">
    
                    Your browser does not support the video tag.
                </video>
    
  • Admin
    Admin about 3 years
    do you convert the videos by hand? Manually? If you do it programmatically, which code do you use?
  • ospider
    ospider over 2 years
    @user15152665 ffmpeg is your friend.