![如何从视频文件中提取音轨并将其保存为 MP3?](https://linux22.com/image/957786/%E5%A6%82%E4%BD%95%E4%BB%8E%E8%A7%86%E9%A2%91%E6%96%87%E4%BB%B6%E4%B8%AD%E6%8F%90%E5%8F%96%E9%9F%B3%E8%BD%A8%E5%B9%B6%E5%B0%86%E5%85%B6%E4%BF%9D%E5%AD%98%E4%B8%BA%20MP3%EF%BC%9F.png)
从视频文件中提取音轨并将其保存为 MP3 文件的最简单方法是什么?
答案1
非常简单的 CLI 解决方案:
ffmpeg -i VIDEOFILE -acodec libmp3lame -metadata TITLE="Name of Song" OUTPUTFILE.mp3
如果您没有安装 ffmpeg:
sudo apt-get install ffmpeg
答案2
您可以在甚高频液晶。
启动 VLC 后:
- 选择“媒体”-->“转换/保存”
- 单击“添加…”并选择所需文件
- 点击“转换/保存”(在底部)
- 提供“目标文件:”
- 选择“配置文件”(例如“音频 - MP3”、“音频 - Vorbis (OGG)”等)
- 点击“开始”
- 放松并享受你的鞋子
您可以从 Synaptic 或软件中心安装 VLC。
答案3
答案4
最好的方法是使用只处理容器的工具。对于 MP4,我推荐MP4Box
使用gpac 包。对于 Matroska 等其他容器,有以下项目和工具:MKVToolNix。
检索有关文件的信息(注意:您也可以使用 执行此操作mediainfo
):
$ MP4Box -info 29c3-5400-en-hacking_cisco_phones_h264.mp4
* Movie Info *
Timescale 1000 - Duration 00:54:30.144
Fragmented File no - 2 track(s)
File Brand isom - version 512
Created: UNKNOWN DATE
File has no MPEG4 IOD/OD
iTunes Info:
Name: Hacking Cisco Phones
Artist: Ang Cui, Michael Costello
Album: Chaos Communication Congress 2012 (29C3)
Comment: http://events.ccc.de/congress/2012/Fahrplan/events/5400.en.html
Genre: lecture
Encoder Software: Lavf54.29.104
Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:54:30.080
Media Info: Language "Undetermined" - Type "vide:avc1" - 81752 samples
Visual Track layout: x=0 y=0 width=1024 height=576
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 576
AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 3
NAL Unit length bits: 32
Pixel Aspect Ratio 64:45 - Indicated track size 1024 x 576
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:54:30.143
Media Info: Language "English" - Type "soun:mp4a" - 153285 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1
将各个曲目提取为原始格式:
$ MP4Box -raw 1 29c3-5400-en-hacking_cisco_phones_h264.mp4
Extracting MPEG-4 AVC-H264 stream to h264
$ MP4Box -raw 2 29c3-5400-en-hacking_cisco_phones_h264.mp4
Extracting MPEG-4 AAC
显示原始文件和结果:
$ ls -1 29c3-5400-en-hacking_cisco_phones_h264*
29c3-5400-en-hacking_cisco_phones_h264.mp4
29c3-5400-en-hacking_cisco_phones_h264_track1.h264
29c3-5400-en-hacking_cisco_phones_h264_track2.aac