问题

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

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

ffmpeg mp4 html5,FFMPEG mkv to mp4 conversion lacks audio in HTML5 player相关推荐

  1. php封装多段mp4,解决ffmpeg将多段视频裁剪拼接后卡顿现象

    合并 将下载的ts流名称按照顺序记录在一个txt文件中,然后使用命令 ffmpeg.exe -f concat -i ./your.txt -c copy ./output.mkv ffmpeg.ex ...

  2. 使用ffmpeg批量转码的命令行(以mkv转mp4为例)

    使用ffmpeg批量转码的命令行(以mkv转mp4为例) 单个文件转码 批量文件转码 使用python和ffmpeg在cmd中实现(没事找事) 单个文件转码 ffmpeg -i INPUTPATH.m ...

  3. FFMPEG h264 ACC 合成 mkv ts;h264 mp3 合成 MP4 avi flv

    FFMPEG h264 ACC 合成 mkv ts:h264 mp3 合成 MP4 avi flv #include <stdio.h>#include <cstdio>#in ...

  4. FFMPEG MKV转换为MP4以及视频分割和合并

    mkv转换为mp4 ffmpeg -i "test.mkv" -vcodec copy -acodec aac 'test.mp4' 分割命令: ffmpeg -ss 00:00: ...

  5. 如何使用ffmpeg将BDMV(m2ts)转换成MKV、MP4等其他格式的文件

    BDMV 是蓝光碟使用的格式.这种格式没有办法使用播放软件播放,必须要用硬盘播放器,也就是专门的设备.但是最经典的 ffmpeg 可以将其转换成其他格式,并且保持相同的码率和清晰度,这样就可以很方便的 ...

  6. Python利用matplotlib.animation和matplotlib.pyplot和ffmpeg录制动画并保存为MP4文件

    因为需要将结果动画保存为MP4视频文件需要ffmepg软件的的支持. 一:安装ffmpeg软件: ffmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源计算机程序.采用LGPL或G ...

  7. FFMPEG采集摄像头图像SDL渲染+MP4格式视频编码

    FFMPEG采集摄像头图像SDL渲染+MP4格式视频编码 FFmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源计算机程序.采用LGPL或GPL许可证.它提供了录制.转换以及流化音 ...

  8. C# 调用ffmpeg把rtsp视频流保存为MP4文件

    在C#中 使用Process 执行ffmpeg命令把RTSP保存为MP4 Task.Run(() => {string ffmpegPath = @"J:\ffmpeg\ffmpeg. ...

  9. 结合python使用ffmpeg将批量ts文件合成mp4。

    一.获取ts文件,如下图所示. 二.安装 ffmpeg 并配置到环境变量 linux: apt-get install ffmpeg libavcodec-extra windows: 1.进入 ht ...

最新文章

  1. 阿里一面 京东一面+二面 | 掘金技术征文
  2. 开发日记-20190517 关键词 函数式编程(一)
  3. 【边缘检测】RCN:Object Contour and Edge Detection with RefineContourNet
  4. .NET Core 2.1路线图
  5. 中高级开发面试必问的Redis面试题,看这篇就够了!
  6. 使用ERStudio创建数据表ER图并导出数据表的SQL(DDL)语句
  7. ML之LIME:基于boston波士顿房价数据集回归预测利用LIME/SP-LIME局部解释图/权重图结合RF随机森林模型实现模型事后解释案例之详细攻略
  8. 腾讯云TDSQL-C云原生数据库技术
  9. 【转载】mysql view prevents operation处理
  10. 严格执行系统,严格止损,不要心存侥幸,勇敢承认错误,不给自己的错误找理由。
  11. 简单命令行创建ReactApp
  12. Django数据库学习——定义用户模型(实例)
  13. Charles 功能介绍和使用教程
  14. 【从零学习OpenCV 4】Windows系统中安装OpenCV 4
  15. Lasso 和 Ridge回归中的超参数调整技巧
  16. 墨盒 连供漏墨恒压问题
  17. 05 pyecharts 基本图表(示例代码+效果图)
  18. Java二维码工具类(超详细注释)
  19. 织梦 php 调用栏目,织梦dedecms如何调用当前栏目文章数
  20. DHT11温湿度传感器学习笔记

热门文章

  1. html5窗口播放插件,基于jQuery UI的模拟windows窗口插件
  2. composition java_阿里P7架构师通过源码浅析Java中的资源加载
  3. vision安装过程中出错_scrapy安装过程中之Twisted的安装遇到的坑
  4. android connect 闪退,Connect闪退
  5. unity2018设置雾在哪_《Babel》项目技术整理:雾
  6. c语言面试会问10个数排序吗,c语言面试最必考的十道试题,求职必看!!!
  7. java jexl_一种表达式语言的解析引擎JEXL简单使用
  8. python 异常点检测 cook距离_DLI 精选课程 | 三种AI方法检测网络、业务或设备异常状况...
  9. java数字时钟控件_Java-数字时钟(简易版)
  10. html怎么实现单个li效果,基于DIV+ul+li实现的表格(多示例)