[英]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
使用以下命令行将mkv
文件转换为mp4
:
ffmpeg -i input.mkv -c copy file-1.mp4
The resulting mp4
plays fine (video and audio) on Linux Mint's Xplayer
.生成的
mp4
可以在Linux Mint's Xplayer
上正常播放(视频和音频)。 But after uploading file-1, it played with no audio.但是上传file-1后,它没有音频播放。 So I uploaded another
mp4
file-2, one I didn't have to convert, and it plays both video and audio without a problem.所以我上传了另一个
mp4
文件 - 2,我不需要转换,它可以毫无问题地播放视频和音频。 So whatever's going on with file-1
seems to be with my use of ffmpeg
.所以无论
file-1
发生了什么似乎都与我对ffmpeg
使用有关。
The player I'm using is called afterglow
.我正在使用的播放器称为
afterglow
。 But the HTML5 player
handles these two files the same way: file-1 & file-2但是
HTML5 player
以相同的方式处理这两个文件:file-1 & file-2
Does anyone know why the ffmpeg
converted file is soundless when played online?有谁知道
ffmpeg
转换后的文件在线播放时为什么ffmpeg
? Is there a different conversion command that ensures converted mkv files
will play with sound by online players?是否有不同的转换命令可以确保转换后的
mkv files
可以通过在线播放器播放声音?
I see several issues:我看到几个问题:
The input has DTS audio.输入具有 DTS 音频。 Although it is supported in MP4 I guess it doesn't work with HTML5.
尽管 MP4 支持它,但我猜它不适用于 HTML5。 You'll have to convert to AAC.
您必须转换为AAC。 Add
-c:a aac
after the -c copy
.在
-c copy
之后添加-c:a aac
。
Your ffmpeg
is old.你的
ffmpeg
是旧的。 The FFmpeg AAC encoder had improvements that your version is missing. FFmpeg AAC 编码器的改进之处在于您的版本缺失。 Avoid any other potential issues by downloading a recent version .
通过下载最新版本避免任何其他潜在问题。
Add -movflags +faststart
.添加
-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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.