How can I extract audio from video with ffmpeg

本文介绍了如何使用FFmpeg命令行工具从视频文件中提取音频,通过-vn选项关闭视频录制并指定-acodec来选择音频编码格式(如MP3或AAC)。确保FFmpeg已安装后,即可执行命令将音频保存为指定格式的文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

To extract audio from a video using FFmpeg, you can use the -vn (no video) and -acodec options to specify the audio codec. Here’s the command you can use:

ffmpeg -i input.mp4 -vn -acodec copy output.mp3

Let’s break down the options used:

  • -i input.mp4: Specifies the input video file.
  • -vn: Disables video recording, ensuring only the audio is processed.
  • -acodec copy: Copies the audio stream from the input file to the output file without re-encoding it.
  • output.mp3: Specifies the output audio file in MP3 format.

Make sure you have FFmpeg installed on your system before running this command. After executing the command, FFmpeg will extract the audio from the video file and save it as an MP3 file with the specified output name.

If you want to convert the audio to a different format or apply any audio-specific settings, you can change the -acodec option accordingly. For example, to convert the audio to AAC format, you can use -acodec aac instead of -acodec copy.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值