ffmpeg map_channel 将第二个单声道文件静音

ffmpeg map_channel 将第二个单声道文件静音

我在选项方面遇到了麻烦-map_channel。我正在使用两个单独的脚本(是的,我知道我可以在一个脚本中完成此操作)。

ffmpeg -threads "16" -i example.mov -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.1.0 left.wav -map_channel 0.1.1 right.wav

该脚本开始用两个通道转码我的音频流,并且两个日志文件看起来一切都运行正常,但我只有通道 0.1.0 上有声音,而通道 0.1.1 是静音的。

在有人要求提供转码日志之前,这里是我的第一个脚本:

ffmpeg version 0.10.2.git Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 16 2013 15:47:31 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --disable-ffplay --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --extra-cflags=-fPIC --enable-libfreetype
libavutil      51. 55.100 / 51. 55.100
libavcodec     54. 23.100 / 54. 23.100
libavformat    54.  6.101 / 54.  6.101
libavdevice    54.  0.100 / 54.  0.100
libavfilter     2. 77.100 /  2. 77.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/content/flowcenter/qt/preti_hd_eng_15.mp4':
Metadata:
major_brand     : mp42
minor_version   : 1
compatible_brands: mp42mp41
creation_time   : 2013-09-02 15:48:40
LOGGER: set frames to 22825
Duration: 00:15:13.56, start: 0.000000, bitrate: 4588 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 4328 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
  creation_time   : 2013-09-02 15:48:40
  handler_name    : Apple Video Media Handler
  Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 255 kb/s
Metadata:
  creation_time   : 2013-09-02 15:48:40
  handler_name    : Apple Sound Media Handler
-map_channel is forwarded to lavfi similarly to -af pan=0x4:c0=c0.
[aformat @ 0x3d3c1c0] auto-inserting filter 'auto-inserted resampler 0' between the filter     'Parsed_anull_0' and the filter 'aformat'
[aresample @ 0x3e0e0a0] chl:stereo fmt:s16 r:48000Hz -> chl:mono fmt:s32 r:48000Hz
[pan @ 0x3d3c7c0] o0 = 1 i0
[pan @ 0x3d3c7c0] Pure channel mapping detected: 0
Output #0, wav, to '/content/flowcenter/other/preti_hd_eng_15_0_1_0.wav':
Metadata:
major_brand     : mp42
minor_version   : 1
compatible_brands: mp42mp41
creation_time   : 2013-09-02 15:48:40
encoder         : Lavf54.6.101
Stream #0:0(eng): Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s32, 1152 kb/s
Metadata:
  creation_time   : 2013-09-02 15:48:40
  handler_name    : Apple Sound Media Handler
Stream mapping:
Stream #0:1 -> #0:0 (aac -> pcm_s24le)
Executing:
"/home/mfc/ffmpeg/0_1_0.wav.sh" 1316720 "/content/flowcenter/qt/preti_hd_eng_15.mp4" "/content/flowcenter/other/preti_hd_eng_15_0_1_0.wav"
ffmpeg -threads 16 -i /content/flowcenter/qt/preti_hd_eng_15.mp4 -acodec pcm_s24le -ar 48000 -ac  1 -map_channel 0.1.0 /content/flowcenter/other/preti_hd_eng_15_0_1_0.wav
 needed 2 seconds
Moved outputfile to new location
198
File MIME Content-Type:audio/x-wav
get video file informations for /content/flowcenter/other/preti_hd_eng_15_0_1_0.wav
index file for cut is enabled.
execute: /home/mfc/bin/mpeginfo --logfile /dev/null --idx-file "/content/flowcenter/mpeg2idx/988409"  "/content/flowcenter/other/preti_hd_eng_15_0_1_0.wav"
* * * Arthur Kleer, v0.9.F.4, r09.10.2011, compiled on Oct  6 2011 (nike) * * *

这是我的第二个脚本:

-map_channel is forwarded to lavfi similarly to -af pan=0x4:c0=c1.
[aformat @ 0x2fb31c0] auto-inserting filter 'auto-inserted resampler 0' between the filter  'Parsed_anull_0' and the filter 'aformat'
[aresample @ 0x30850a0] chl:stereo fmt:s16 r:48000Hz -> chl:mono fmt:s32 r:48000Hz
[pan @ 0x2fb37c0] o0 = 0 i0
[pan @ 0x2fb37c0] Pure channel mapping detected: M
Output #0, wav, to '/content/flowcenter/other/preti_hd_eng_15_0_1_1.wav':
Metadata:
major_brand     : mp42
minor_version   : 1
compatible_brands: mp42mp41
creation_time   : 2013-09-02 15:48:40
encoder         : Lavf54.6.101
Stream #0:0(eng): Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s32, 1152 kb/s
Metadata:
  creation_time   : 2013-09-02 15:48:40
  handler_name    : Apple Sound Media Handler
Stream mapping:
Stream #0:1 -> #0:0 (aac -> pcm_s24le)
Executing:
"/home/mfc/ffmpeg/0_1_1.wav.sh" 1316719 "/content/flowcenter/qt/preti_hd_eng_15.mp4" "/content/flowcenter/other/preti_hd_eng_15_0_1_1.wav"
ffmpeg -threads 16 -i /content/flowcenter/qt/preti_hd_eng_15.mp4 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.1.1 /content/flowcenter/other/preti_hd_eng_15_0_1_1.wav
needed 33 seconds
Moved outputfile to new location
198
File MIME Content-Type:audio/x-wav
get video file informations for /content/flowcenter/other/preti_hd_eng_15_0_1_1.wav
index file for cut is enabled.
execute: /home/mfc/bin/mpeginfo --logfile /dev/null --idx-file "/content/flowcenter/mpeg2idx/988408"  "/content/flowcenter/other/preti_hd_eng_15_0_1_1.wav"
* * * Arthur Kleer, v0.9.F.4, r09.10.2011, compiled on Oct  6 2011 (nike) * * *

有人知道为什么会发生这种情况吗?或者有人有其他方法可以将立体声变成两个单声道文件吗?我也尝试了pan选项,但我找不到找出平移选项的方法(ffmpeg 文档在这种情况下没有太大帮助)

编辑:尝试使用pan选项执行相同的操作效果很好,但前提是输入文件有一个音频流和两个音频通道,只有一个音频通道ffmpeg也会创建两个音频通道,尽管应该只创建一个。我知道我可以为每个剪辑手动执行此操作,但我希望有一个通用的解决方案。

平移脚本: ffmpeg -threads "16" -i example.mov -acodec pcm_s24le -ar 48000 -af pan=1:c0=c0 left.wav -af pan=1:c0=c1 right.wav

相关内容