此命令中有filter_complex
和选项:atrim
FFmpeg
ffmpeg -i adele.mp3
-i Ruby\ on\ Rails\ 101-\ What\ is\ Ruby\ on\ Rails_.mp4 -filter_complex \
"[0:a]aformat=sample_fmts=fltp:sample_rates=44100:
channel_layouts=stereo,volume=0.5,
atrim=end=12,asetpts=PTS-STARTPTS[a1];
[1:a]aformat=sample_fmts=fltp:sample_rates=44100:
channel_layouts=stereo,volume=0.8[a2];
[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]" \
-strict -2 -map 1:v -map "[out]" -c:v copy -c:a libfdk_aac output.mp4
我计划剪切第一个音频流(adele.mp3
)——按照过滤只剪切音频的前 12 秒atrim=end=12
。
前 12 秒与第二个音频流(来自视频本身)一起按预期工作,但 12 秒后第二个音频流变为静音(根本没有音量)。
我不喜欢静音或删除第二个音频流的音频。我认为它会在其他地方受到影响。
任何解决办法都将受到赞赏。
顺便说一下,这是日志:
ffmpeg version N-60332-ga0d5204 Copyright (c) 2000-2014 the FFmpeg developers
built on Feb 4 2014 21:31:51 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
libavutil 52. 63.100 / 52. 63.100
libavcodec 55. 49.101 / 55. 49.101
libavformat 55. 29.101 / 55. 29.101
libavdevice 55. 7.100 / 55. 7.100
libavfilter 4. 1.102 / 4. 1.102
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mp3, from 'adele.mp3':
Metadata:
title : Chasing Pavements
artist : Adele
track : 3
album : 19 (Deluxe Edition)
date : 2008
Duration: 00:03:30.55, start: 0.025056, bitrate: 160 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 159 kb/s
Stream #0:1: Video: mjpeg, yuvj420p(pc), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
Metadata:
title :
comment : Other
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Ruby on Rails 101- What is Ruby on Rails_.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2013-12-21 07:56:20
Duration: 00:05:42.40, start: 0.000000, bitrate: 1214 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1020 kb/s, 30 fps, 30 tbr, 60 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default)
Metadata:
creation_time : 2013-12-21 07:56:23
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_pan_7 @ 0x7fbe71437480] This syntax is deprecated. Use '|' to separate the list items.
File 'output.mp4' already exists. Overwrite ? [y/N] y
[Parsed_amerge_6 @ 0x7fbe71436d40] No channel layout for input 1
[Parsed_amerge_6 @ 0x7fbe71436d40] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp4, to 'output.mp4':
Metadata:
title : Chasing Pavements
artist : Adele
track : 3
album : 19 (Deluxe Edition)
date : 2008
encoder : Lavf55.29.101
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=2-31, 1020 kb/s, 30 fps, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Stream mapping:
Stream #0:0 (mp3) -> aformat
Stream #1:1 (aac) -> aformat
Stream #1:0 -> #0:0 (copy)
pan -> Stream #0:1 (libfdk_aac)
Press [q] to stop, [?] for help
Error while decoding stream #1:1: Cannot allocate memory
Last message repeated 82 times
Error while decoding stream #1:1: Cannot allocate memory.01 bitrate= 905.2kbits/s
Last message repeated 3821 times
Error while decoding stream #1:1: Cannot allocate memory3.55 bitrate= 131.3kbits/s
Last message repeated 3219 times
Error while decoding stream #1:1: Cannot allocate memory8.51 bitrate= 76.1kbits/s
Last message repeated 3247 times
Error while decoding stream #1:1: Cannot allocate memory4.01 bitrate= 53.5kbits/s
Last message repeated 3443 times
Error while decoding stream #1:1: Cannot allocate memory4.01 bitrate= 40.7kbits/s
Last message repeated 380 times
frame=10272 fps=3141 q=-1.0 Lsize= 42882kB time=00:05:42.38 bitrate=1026.0kbits/s
video:42642kB audio:189kB subtitle:0 data:0 global headers:0kB muxing overhead 0.120036%