当前位置: 首页 > news >正文

How to use ffmpeg to convert video format from .webm to .mp4

The .mp4 container format doesn’t support the VP8 codec, which is commonly used in .webm files. MP4 containers typically use the H.264 codec for video and AAC for audio.

You’ll need to re-encode the video using the H.264 codec and re-encode the audio using AAC (or another supported audio codec) for proper conversion. Here’s the updated command:

Correct Command

ffmpeg -ss 00:00:20 -i input.webm -c:v libx264 -c:a aac -strict experimental output.mp4

Explanation:

  • -c:v libx264: Re-encodes the video using the H.264 codec (which is compatible with .mp4).
  • -c:a aac: Re-encodes the audio using the AAC codec (which is supported by .mp4).
  • -strict experimental: This flag allows the use of experimental features, which may be necessary for AAC encoding in some versions of FFmpeg.

Optional: Adjust Quality and Bitrate

You can also control the quality of the output video by adding the -crf option for video quality and the -b:a option for audio bitrate:

  • -crf 23: Controls the quality of the video (lower values give better quality but larger file sizes, with 23 being a reasonable default).
  • -b:a 128k: Sets the audio bitrate to 128 kbps, which is typically good for most purposes.

For example:

ffmpeg -ss 00:00:20 -i input.webm -c:v libx264 -crf 23 -c:a aac -b:a 128k -strict experimental output.mp4
http://www.lryc.cn/news/478858.html

相关文章:

  • Halcon 从XML中读取配置参数
  • hive表内外表之间切换
  • 电子邮件营销软件哪个好?
  • OpenAI大事记;GPT到ChatGPT参数量进化
  • springboot020基于Java的免税商品优选购物商城设计与实现
  • 代码随想录之字符串刷题总结
  • PS-基础学习(常用快捷键1.2-1.3)
  • qt QListView详解
  • 287. 寻找重复数
  • 2024年最受欢迎的编程语言
  • C++ 线程初始化编译报错
  • [MySQL]视图
  • Windows Server2012 R2搭建NFS服务器
  • SQL题:使用hive查询各类型专利top 10申请人,以及对应的专利申请数
  • 使用sealos部署的集群在部署metrics-server时日志x509
  • WPF怎么通过RestSharp向后端发请求
  • promise的用法以及注意事项,看了这篇你就会了
  • vue3如何使用pinia设置全局状态,附常见面试题
  • lerna+umi ‘max‘ 不是内部或外部命令,也不是可运行的程序
  • 美格智能5G车规级通信模组: 5G+C-V2X连接汽车通信未来十年
  • 「C/C++」C/C++ 指针篇 之 指针运算
  • 计算机网络网络层笔记
  • 长亭那个检测能力超强的 WAF,出免费版啦
  • rabbitMQ RabbitTemplate 发送消息
  • 本系列是《10万字208道Java经典面试题总结(附答案)》的2024修订版。
  • C语言文件基础概念的理解(一)
  • C++ lambda 匿名函数
  • 基于python的简单web服务器示例
  • 02- 模块化编程-006 ADC0808数码显示对比
  • 又发现了Mac妙控鼠标的新使用方法