我正在尝试对视频中的音频进行降噪。我确定这在 ffmpeg 中实际上是不可能的,所以我用这种方式从视频中提取了音频。
$ ffmpeg -i found1-1.mp4 audio.mp3
$ ffmpeg -i found1-1.mp4 -an -c:v copy videomute.mp4
然后,我在外部程序中清理了音频,现在我想将其与视频文件重新组合。这就是我遇到的问题。当我使用以下命令将音频与视频重新组合时,Quicktime 中没有音频(也没有音量滑块)。但是,当我使用 VLC ffplay 播放电影时,它确实存在。
ffmpeg -i clean_audio.mp3 -i videomute.mp4 -acodec copy -vcodec copy output.mp4
我以为可能是音频文件出了问题,但事实证明原始音频在 QuickTime 中也无法播放。
ffmpeg -i orig_audio.mp3 -i videomute.mp4 -acodec copy -vcodec copy output.mp4
发生了什么事?我担心视频编码有问题,而且由于我制作的是商业产品,我的一些用户将无法在某些播放器中正确听到音频。我做错了什么?
一些可能有用的附加 CLI 信息:
[email protected] 09:40 AM /Volumes/ben_lib_red_external_drive/storage/idance/resources_master/lessons/raw_source/skippy_blair/tmp >
$ ffprobe found1-1.mp4
ffprobe version 2.2.1 Copyright (c) 2007-2014 the FFmpeg developers
built on Jun 5 2014 19:48:42 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libass --enable-ffplay
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'found1-1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2014-09-15 18:23:44
encoder : HandBrake 0.9.9 2013052900
Duration: 00:59:36.47, start: 0.000000, bitrate: 876 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x544, 725 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2014-09-15 18:23:44
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 145 kb/s (default)
Metadata:
creation_time : 2014-09-15 18:23:44
[email protected] 09:40 AM /Volumes/ben_lib_red_external_drive/storage/idance/resources_master/lessons/raw_source/skippy_blair/tmp >
$ ffmpeg -i found1-1.mp4 audio.mp3
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 5 2014 19:48:42 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libass --enable-ffplay
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'found1-1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2014-09-15 18:23:44
encoder : HandBrake 0.9.9 2013052900
Duration: 00:59:36.47, start: 0.000000, bitrate: 876 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x544, 725 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2014-09-15 18:23:44
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 145 kb/s (default)
Metadata:
creation_time : 2014-09-15 18:23:44
File 'audio.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to 'audio.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
TSSE : Lavf55.33.100
Stream #0:0(und): Audio: mp3 (libmp3lame), 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2014-09-15 18:23:44
Stream mapping:
Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press [q] to stop, [?] for help
size= 55880kB time=00:59:36.28 bitrate= 128.0kbits/s
video:0kB audio:55880kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000584%
[email protected] 09:46 AM /Volumes/ben_lib_red_external_drive/storage/idance/resources_master/lessons/raw_source/skippy_blair/tmp >
$ ffmpeg -i audio.mp3 -i videomute.mp4 -acodec copy -vcodec copy output.mp4
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 5 2014 19:48:42 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libass --enable-ffplay
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mp3, from 'audio.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf55.33.100
Duration: 00:59:36.29, start: 0.023021, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 128 kb/s
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'videomute.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:59:36.47, start: 0.000000, bitrate: 728 kb/s
Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x544, 725 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf55.33.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x544, q=2-31, 725 kb/s, 29.97 fps, 90k tbn, 90k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Audio: mp3 (i[0][0][0] / 0x0069), 48000 Hz, stereo, 128 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=107183 fps=10105 q=-1.0 Lsize= 375652kB time=00:59:36.30 bitrate= 860.5kbits/s
video:316698kB audio:55880kB subtitle:0 data:0 global headers:0kB muxing overhead 0.825099%
[email protected] 09:48 AM /Volumes/ben_lib_red_external_drive/storage/idance/resources_master/lessons/raw_source/skippy_blair/tmp >
$ ffprobe output.mp4
ffprobe version 2.2.1 Copyright (c) 2007-2014 the FFmpeg developers
built on Jun 5 2014 19:48:42 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libass --enable-ffplay
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:59:36.47, start: 0.023021, bitrate: 860 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x544, 725 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 128 kb/s (default)
Metadata:
handler_name : SoundHandler