I used ffmpeg
to convert an mkv
file to mp4
using this command line:
ffmpeg -i input.mkv -c copy file-1.mp4
The resulting mp4
plays fine (video and audio) on Linux Mint's Xplayer
. But after uploading file-1, it played with no audio. So I uploaded another mp4
file-2, one I didn't have to convert, and it plays both video and audio without a problem. So whatever's going on with file-1
seems to be with my use of ffmpeg
.
The player I'm using is called afterglow
. But the HTML5 player
handles these two files the same way: file-1 & file-2
Does anyone know why the ffmpeg
converted file is soundless when played online? Is there a different conversion command that ensures converted mkv files
will play with sound by online players?
After converting videos using FFmpeg, most of the users have observed that the converted MP4 video lacks audio. In addition to this, users have also found that the converted MP4 videos does not have the subtitles that where originally present in MKV source video. Most of the times, the conversion command does not work when using FFmpeg.
The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.
For that, FFmpeg also allows you to modify the codecs to a certain one. For example, if you want to FFmpeg convert to MP4 with H264 codec. You can input: ffmpeg –i input.mkv –c:v h264 output.mp4 -c:v means the following character is used to nominate the codec of video.
For example, if you want to FFmpeg convert to MP4 with H264 codec. You can input: ffmpeg –i input.mkv –c:v h264 output.mp4 -c:v means the following character is used to nominate the codec of video.
I see several issues:
The input has DTS audio. Although it is supported in MP4 I guess it doesn't work with HTML5. You'll have to convert to AAC. Add -c:a aac
after the -c copy
.
Your ffmpeg
is old. The FFmpeg AAC encoder had improvements that your version is missing. Avoid any other potential issues by downloading a recent version.
Add -movflags +faststart
. This will move some info in the file after encoding so it can begin playback quicker; otherwise it will have to download the whole video before playing.
Example command:
ffmpeg -i input.mkv -c copy -c:a aac -movflags +faststart output.mp4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With