600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > ffmpeg mp4 html5 FFMPEG mkv to mp4 conversion lacks audio in HTML5 player

ffmpeg mp4 html5 FFMPEG mkv to mp4 conversion lacks audio in HTML5 player

时间:2022-07-24 17:01:21

相关推荐

ffmpeg mp4 html5 FFMPEG mkv to mp4 conversion lacks audio in HTML5 player

问题

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?

回答1:

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

来源:/questions/46456692/ffmpeg-mkv-to-mp4-conversion-lacks-audio-in-html5-player

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。