通过ffmpeg命令合并多部电影的音频

Merge audio of multiple movies by ffmpeg command

我想将 3 个视频文件合并为一个。我的问题是我只能听到 2 的音频。其中一个静音了。

我执行的命令将依次显示 3 部电影,并且应该播放整个 3 部电影的音频。

这是我的查询:

complexCommand = new String[]{"-i", tempPath1, "-i", tempPath2,"-i", tempPath3,"-filter_complex",
                        "[0:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=green[a];" +
                        "[1:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=red[b];" +
                        "[2:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=blue[c];" +
                        "[b][c]hstack=inputs=2,scale=iw/2:-2[bottom];" +
                        "[a][bottom]vstack=inputs=2,scale=ih*2:-2[video];" +
                        "[0:a][1:a]amerge=inputs=2[audio];" +    // take audio first movie, take audio second movie and merge with 2 inputs
                        "[audio][2:a]amerge=inputs=2[audio1]",
                        "-map",                 // map of the video
                        "[video]",
                        "-map",                 // map of the audio
                        "[audio1]",
                        "-ac",
                        "2",                    // number of chanels
                        outputFilePath};

这个命令的结果是我只能听到电影a和b。 非常感谢:)

编辑

我也试过这个:

complexCommand = new String[]{"-i", tempPath1, "-i", tempPath2,"-i", tempPath3,"-filter_complex",
                        "[0:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=green[a];" +
                        "[1:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=red[b];" +
                        "[2:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=blue[c];" +
                        "[b][c]hstack=inputs=2,scale=iw/2:-2[bottom];" +
                        "[a][bottom]vstack=inputs=2,scale=ih*2:-2[video];" +
                        "[0:a][1:a][2:a]amerge=inputs=3[audio]",
                        "-map",                 // map of the video
                        "[video]",
                        "-map",                 // map of the audio
                        "[audio]",
                        "-ac",
                        "2",                    // number of chanels
                        outputFilePath};

另一个编辑

又查了下,发现他并没有合并上次的电影音频。另外,如果我有 4 部电影,它会合并 3 部电影,你听不到最后一部电影。

日志(太长 - 这是它的后半部分):

10.417 Started command progress : ffmpeg frame=  102 fps=1.2 q=28.0 size=     344kB time=00:00:04.24 bitrate= 662.5kbits/s dup=1 drop=122 speed=0.0495x    
16.670 Started command progress : ffmpeg frame=  103 fps=1.1 q=28.0 size=     361kB time=00:00:04.29 bitrate= 689.2kbits/s dup=1 drop=123 speed=0.0466x    
17.329 Started command progress : ffmpeg frame=  104 fps=1.1 q=28.0 size=     366kB time=00:00:04.33 bitrate= 691.2kbits/s dup=1 drop=124 speed=0.0467x    
18.067 Started command progress : ffmpeg frame=  105 fps=1.1 q=28.0 size=     368kB time=00:00:04.37 bitrate= 688.3kbits/s dup=1 drop=125 speed=0.0468x    
18.658 Started command progress : ffmpeg frame=  106 fps=1.1 q=28.0 size=     371kB time=00:00:04.41 bitrate= 687.5kbits/s dup=1 drop=127 speed=0.0469x    
19.275 Started command progress : ffmpeg frame=  107 fps=1.1 q=28.0 size=     384kB time=00:00:04.46 bitrate= 705.0kbits/s dup=1 drop=128 speed=0.0471x    
20.951 Started command progress : ffmpeg frame=  108 fps=1.1 q=28.0 size=     388kB time=00:00:04.50 bitrate= 706.2kbits/s dup=1 drop=129 speed=0.0467x    
21.619 Started command progress : ffmpeg frame=  109 fps=1.1 q=28.0 size=     390kB time=00:00:04.52 bitrate= 706.2kbits/s dup=1 drop=130 speed=0.0466x    
22.170 Started command progress : ffmpeg frame=  110 fps=1.1 q=28.0 size=     393kB time=00:00:04.56 bitrate= 704.5kbits/s dup=1 drop=132 speed=0.0468x    
25.697 Started command progress : ffmpeg frame=  111 fps=1.1 q=28.0 size=     408kB time=00:00:04.63 bitrate= 720.8kbits/s dup=1 drop=133 speed=0.0458x    
30.467 Started command progress : ffmpeg frame=  112 fps=1.1 q=28.0 size=     413kB time=00:00:04.67 bitrate= 723.8kbits/s dup=1 drop=134 speed=0.0441x    
31.884 Started command progress : ffmpeg frame=  113 fps=1.1 q=28.0 size=     415kB time=00:00:04.69 bitrate= 723.9kbits/s dup=1 drop=135 speed=0.0437x    
32.360 Started command progress : ffmpeg frame=  113 fps=1.0 q=28.0 size=     415kB time=00:00:04.73 bitrate= 717.4kbits/s dup=1 drop=136 speed=0.0439x    
37.274 Started command progress : ffmpeg frame=  115 fps=1.0 q=28.0 size=     435kB time=00:00:04.80 bitrate= 741.3kbits/s dup=1 drop=138 speed=0.0426x    
38.060 Started command progress : ffmpeg frame=  116 fps=1.0 q=28.0 size=     439kB time=00:00:04.82 bitrate= 746.1kbits/s dup=1 drop=139 speed=0.0425x    
38.779 Started command progress : ffmpeg frame=  117 fps=1.0 q=28.0 size=     441kB time=00:00:04.86 bitrate= 743.2kbits/s dup=1 drop=140 speed=0.0426x    
39.463 Started command progress : ffmpeg frame=  118 fps=1.0 q=28.0 size=     445kB time=00:00:04.90 bitrate= 742.3kbits/s dup=1 drop=142 speed=0.0427x    
40.074 Started command progress : ffmpeg frame=  119 fps=1.0 q=28.0 size=     458kB time=00:00:04.97 bitrate= 753.8kbits/s dup=1 drop=143 speed=0.043x    
42.906 Started command progress : ffmpeg frame=  120 fps=1.0 q=28.0 size=     462kB time=00:00:04.99 bitrate= 758.1kbits/s dup=1 drop=144 speed=0.0422x    
43.884 Started command progress : ffmpeg frame=  121 fps=1.0 q=28.0 size=     464kB time=00:00:05.03 bitrate= 754.6kbits/s dup=1 drop=145 speed=0.0422x    
44.378 Started command progress : ffmpeg frame=  121 fps=1.0 q=28.0 size=     464kB time=00:00:05.07 bitrate= 748.2kbits/s dup=1 drop=146 speed=0.0424x    
52.351 Started command progress : ffmpeg frame=  123 fps=1.0 q=28.0 size=     481kB time=00:00:05.12 bitrate= 768.5kbits/s dup=1 drop=148 speed=0.0401x    
55.804 Started command progress : ffmpeg frame=  124 fps=0.9 q=28.0 size=     485kB time=00:00:05.16 bitrate= 768.6kbits/s dup=1 drop=149 speed=0.0394x    
56.404 Started command progress : ffmpeg frame=  124 fps=0.9 q=28.0 size=     485kB time=00:00:05.18 bitrate= 765.4kbits/s dup=1 drop=149 speed=0.0393x    
57.011 Started command progress : ffmpeg frame=  125 fps=0.9 q=28.0 size=     487kB time=00:00:05.20 bitrate= 765.4kbits/s dup=1 drop=150 speed=0.0393x    
57.549 Started command progress : ffmpeg frame=  125 fps=0.9 q=28.0 size=     487kB time=00:00:05.25 bitrate= 759.2kbits/s dup=1 drop=151 speed=0.0395x    
58.072 Started command progress : ffmpeg frame=  126 fps=0.9 q=28.0 size=     489kB time=00:00:05.27 bitrate= 760.4kbits/s dup=1 drop=152 speed=0.0395x    
03.052 Started command progress : ffmpeg frame=  127 fps=0.9 q=28.0 size=     504kB time=00:00:05.29 bitrate= 779.9kbits/s dup=1 drop=153 speed=0.0382x    
04.000 Started command progress : ffmpeg frame=  128 fps=0.9 q=28.0 size=     509kB time=00:00:05.33 bitrate= 781.5kbits/s dup=1 drop=154 speed=0.0383x    
04.841 Started command progress : ffmpeg frame=  129 fps=0.9 q=28.0 size=     511kB time=00:00:05.35 bitrate= 781.3kbits/s dup=1 drop=155 speed=0.0382x    
05.615 Started command progress : ffmpeg frame=  129 fps=0.9 q=28.0 size=     511kB time=00:00:05.39 bitrate= 775.1kbits/s dup=1 drop=156 speed=0.0383x    
06.627 Started command progress : ffmpeg frame=  130 fps=0.9 q=28.0 size=     514kB time=00:00:05.42 bitrate= 776.8kbits/s dup=1 drop=157 speed=0.0382x    
07.511 Started command progress : ffmpeg frame=  131 fps=0.9 q=28.0 size=     525kB time=00:00:05.46 bitrate= 786.6kbits/s dup=1 drop=158 speed=0.0383x    
12.298 Started command progress : ffmpeg frame=  132 fps=0.9 q=28.0 size=     529kB time=00:00:05.48 bitrate= 789.4kbits/s dup=1 drop=159 speed=0.0382x    
12.306 Started command progress : ffmpeg frame=  132 fps=0.9 q=28.0 size=     529kB time=00:00:05.48 bitrate= 789.4kbits/s dup=1 drop=159 speed=0.0371x    
12.814 Started command progress : ffmpeg frame=  133 fps=0.9 q=28.0 size=     530kB time=00:00:05.48 bitrate= 792.1kbits/s dup=1 drop=160 speed=0.037x    
13.584 Started command progress : ffmpeg frame=  134 fps=0.9 q=28.0 size=     533kB time=00:00:05.48 bitrate= 796.2kbits/s dup=1 drop=162 speed=0.0368x    
18.744 Started command progress : ffmpeg frame=  135 fps=0.9 q=28.0 size=     547kB time=00:00:05.48 bitrate= 817.1kbits/s dup=1 drop=163 speed=0.0356x    
19.776 Started command progress : ffmpeg frame=  136 fps=0.9 q=28.0 size=     551kB time=00:00:05.48 bitrate= 823.3kbits/s dup=1 drop=164 speed=0.0353x    
20.554 Started command progress : ffmpeg frame=  137 fps=0.9 q=28.0 size=     553kB time=00:00:05.48 bitrate= 825.9kbits/s dup=1 drop=164 speed=0.0352x    
21.113 Started command progress : ffmpeg frame=  138 fps=0.9 q=28.0 size=     556kB time=00:00:05.48 bitrate= 830.1kbits/s dup=1 drop=165 speed=0.035x    
23.823 Started command progress : ffmpeg frame=  139 fps=0.9 q=28.0 size=     570kB time=00:00:05.48 bitrate= 850.8kbits/s dup=1 drop=165 speed=0.0344x    
24.546 Started command progress : ffmpeg frame=  140 fps=0.9 q=28.0 size=     574kB time=00:00:05.48 bitrate= 857.3kbits/s dup=1 drop=165 speed=0.0343x    
25.038 Started command progress : ffmpeg frame=  141 fps=0.9 q=28.0 size=     576kB time=00:00:05.48 bitrate= 860.0kbits/s dup=1 drop=165 speed=0.0342x    
29.407 Started command progress : ffmpeg frame=  143 fps=0.9 q=28.0 size=     591kB time=00:00:05.48 bitrate= 882.6kbits/s dup=1 drop=166 speed=0.0333x    
32.181 Started command progress : ffmpeg frame=  144 fps=0.9 q=28.0 size=     595kB time=00:00:05.48 bitrate= 888.4kbits/s dup=1 drop=166 speed=0.0327x    
32.721 Started command progress : ffmpeg frame=  145 fps=0.9 q=28.0 size=     597kB time=00:00:05.48 bitrate= 891.0kbits/s dup=1 drop=166 speed=0.0326x    
37.640 Started command progress : ffmpeg frame=  147 fps=0.8 q=28.0 size=     613kB time=00:00:05.48 bitrate= 915.5kbits/s dup=1 drop=167 speed=0.0317x    
38.409 Started command progress : ffmpeg frame=  148 fps=0.9 q=28.0 size=     617kB time=00:00:05.48 bitrate= 922.0kbits/s dup=1 drop=167 speed=0.0315x    
38.954 Started command progress : ffmpeg frame=  149 fps=0.9 q=28.0 size=     619kB time=00:00:05.48 bitrate= 924.8kbits/s dup=1 drop=167 speed=0.0314x    
43.249 Started command progress : ffmpeg frame=  151 fps=0.8 q=28.0 size=     638kB time=00:00:05.48 bitrate= 952.7kbits/s dup=1 drop=168 speed=0.0307x    
44.711 Started command progress : ffmpeg frame=  152 fps=0.8 q=28.0 size=     642kB time=00:00:05.48 bitrate= 959.6kbits/s dup=1 drop=168 speed=0.0304x    
45.362 Started command progress : ffmpeg frame=  153 fps=0.8 q=28.0 size=     644kB time=00:00:05.48 bitrate= 962.3kbits/s dup=1 drop=168 speed=0.0303x    
47.986 Started command progress : ffmpeg frame=  155 fps=0.8 q=28.0 size=     658kB time=00:00:05.48 bitrate= 983.4kbits/s dup=1 drop=169 speed=0.0299x    
51.033 Started command progress : ffmpeg frame=  156 fps=0.8 q=28.0 size=     663kB time=00:00:05.48 bitrate= 989.6kbits/s dup=1 drop=169 speed=0.0294x    
51.644 Started command progress : ffmpeg frame=  157 fps=0.8 q=28.0 size=     664kB time=00:00:05.48 bitrate= 992.4kbits/s dup=1 drop=169 speed=0.0293x    
52.227 Started command progress : ffmpeg frame=  158 fps=0.8 q=28.0 size=     667kB time=00:00:05.48 bitrate= 996.2kbits/s dup=1 drop=170 speed=0.0292x    
55.997 Started command progress : ffmpeg frame=  159 fps=0.8 q=28.0 size=     679kB time=00:00:05.48 bitrate=1014.6kbits/s dup=1 drop=170 speed=0.0286x    
57.421 Started command progress : ffmpeg frame=  160 fps=0.8 q=28.0 size=     684kB time=00:00:05.48 bitrate=1022.2kbits/s dup=1 drop=170 speed=0.0284x    
57.968 Started command progress : ffmpeg frame=  161 fps=0.8 q=28.0 size=     686kB time=00:00:05.48 bitrate=1025.0kbits/s dup=1 drop=170 speed=0.0284x    
02.301 Started command progress : ffmpeg frame=  163 fps=0.8 q=28.0 size=     704kB time=00:00:05.48 bitrate=1051.4kbits/s dup=1 drop=171 speed=0.0277x    
02.318 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
03.129 Started command progress : ffmpeg frame=  164 fps=0.8 q=28.0 size=     708kB time=00:00:05.48 bitrate=1058.1kbits/s dup=1 drop=171 speed=0.0276x    
03.135 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
03.791 Started command progress : ffmpeg     Last message repeated 2 times
03.804 Started command progress : ffmpeg frame=  165 fps=0.8 q=28.0 size=     710kB time=00:00:05.48 bitrate=1060.7kbits/s dup=1 drop=171 speed=0.0275x    
03.818 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
10.434 Started command progress : ffmpeg     Last message repeated 3 times
10.436 Started command progress : ffmpeg frame=  167 fps=0.8 q=28.0 size=     728kB time=00:00:05.48 bitrate=1087.9kbits/s dup=1 drop=172 speed=0.0266x    
11.139 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
11.140 Started command progress : ffmpeg frame=  168 fps=0.8 q=28.0 size=     733kB time=00:00:05.48 bitrate=1094.8kbits/s dup=1 drop=172 speed=0.0265x    
11.148 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
11.654 Started command progress : ffmpeg     Last message repeated 1 times
11.655 Started command progress : ffmpeg frame=  169 fps=0.8 q=28.0 size=     735kB time=00:00:05.48 bitrate=1097.6kbits/s dup=1 drop=172 speed=0.0265x    
11.660 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
13.730 Started command progress : ffmpeg     Last message repeated 4 times
13.732 Started command progress : ffmpeg frame=  171 fps=0.8 q=28.0 size=     750kB time=00:00:05.48 bitrate=1119.6kbits/s dup=1 drop=173 speed=0.0262x    
14.493 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
14.495 Started command progress : ffmpeg frame=  172 fps=0.8 q=28.0 size=     754kB time=00:00:05.48 bitrate=1125.7kbits/s dup=1 drop=173 speed=0.0261x    
14.510 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
15.764 Started command progress : ffmpeg     Last message repeated 1 times
15.768 Started command progress : ffmpeg frame=  173 fps=0.8 q=28.0 size=     756kB time=00:00:05.48 bitrate=1128.7kbits/s dup=1 drop=173 speed=0.026x    
15.967 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
17.594 Started command progress : ffmpeg     Last message repeated 4 times
17.600 Started command progress : ffmpeg frame=  175 fps=0.8 q=28.0 size=     769kB time=00:00:05.48 bitrate=1148.9kbits/s dup=1 drop=174 speed=0.0257x    
22.264 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
22.270 Started command progress : ffmpeg frame=  176 fps=0.8 q=28.0 size=     773kB time=00:00:05.48 bitrate=1154.6kbits/s dup=1 drop=174 speed=0.0252x    
22.273 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
22.794 Started command progress : ffmpeg     Last message repeated 1 times
22.796 Started command progress : ffmpeg frame=  177 fps=0.8 q=28.0 size=     775kB time=00:00:05.48 bitrate=1157.0kbits/s dup=1 drop=174 speed=0.0251x    
22.997 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
26.730 Started command progress : ffmpeg     Last message repeated 3 times
26.732 Started command progress : ffmpeg frame=  179 fps=0.8 q=28.0 size=     792kB time=00:00:05.48 bitrate=1182.5kbits/s dup=1 drop=175 speed=0.0247x    
26.736 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
27.345 Started command progress : ffmpeg     Last message repeated 1 times
27.347 Started command progress : ffmpeg frame=  180 fps=0.8 q=28.0 size=     796kB time=00:00:05.48 bitrate=1188.9kbits/s dup=1 drop=175 speed=0.0246x    
27.811 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
28.017 Started command progress : ffmpeg     Last message repeated 2 times
28.019 Started command progress : ffmpeg frame=  181 fps=0.8 q=28.0 size=     798kB time=00:00:05.48 bitrate=1192.1kbits/s dup=1 drop=175 speed=0.0245x    
28.027 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
31.612 Started command progress : ffmpeg     Last message repeated 2 times
31.617 Started command progress : ffmpeg frame=  183 fps=0.8 q=28.0 size=     820kB time=00:00:05.48 bitrate=1224.5kbits/s dup=1 drop=176 speed=0.0242x    
31.620 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
32.251 Started command progress : ffmpeg     Last message repeated 1 times
32.254 Started command progress : ffmpeg frame=  184 fps=0.8 q=28.0 size=     827kB time=00:00:05.48 bitrate=1234.7kbits/s dup=1 drop=176 speed=0.0241x    
32.654 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
32.828 Started command progress : ffmpeg     Last message repeated 2 times
32.833 Started command progress : ffmpeg frame=  185 fps=0.8 q=28.0 size=     828kB time=00:00:05.48 bitrate=1237.4kbits/s dup=1 drop=176 speed=0.024x    
33.093 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
38.362 Started command progress : ffmpeg     Last message repeated 2 times
38.363 Started command progress : ffmpeg frame=  187 fps=0.8 q=28.0 size=     833kB time=00:00:05.50 bitrate=1240.0kbits/s dup=1 drop=177 speed=0.0235x    
38.370 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
39.216 Started command progress : ffmpeg     Last message repeated 1 times
39.217 Started command progress : ffmpeg frame=  188 fps=0.8 q=28.0 size=     833kB time=00:00:05.54 bitrate=1230.7kbits/s dup=1 drop=177 speed=0.0236x    
39.744 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
39.747 Started command progress : ffmpeg frame=  189 fps=0.8 q=28.0 size=     833kB time=00:00:05.58 bitrate=1221.5kbits/s dup=1 drop=177 speed=0.0238x    
39.748 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
40.354 Started command progress : ffmpeg     Last message repeated 4 times
40.355 Started command progress : ffmpeg frame=  191 fps=0.8 q=28.0 size=     833kB time=00:00:05.67 bitrate=1203.6kbits/s dup=1 drop=178 speed=0.0241x    
41.031 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
41.037 Started command progress : ffmpeg frame=  192 fps=0.8 q=28.0 size=     833kB time=00:00:05.71 bitrate=1194.8kbits/s dup=1 drop=178 speed=0.0242x    
41.046 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
41.557 Started command progress : ffmpeg     Last message repeated 1 times
41.561 Started command progress : ffmpeg frame=  193 fps=0.8 q=28.0 size=     833kB time=00:00:05.75 bitrate=1186.1kbits/s dup=1 drop=178 speed=0.0243x    
41.744 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
42.421 Started command progress : ffmpeg     Last message repeated 4 times
42.423 Started command progress : ffmpeg frame=  195 fps=0.8 q=28.0 size=     833kB time=00:00:05.83 bitrate=1169.2kbits/s dup=1 drop=179 speed=0.0245x    
47.015 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
47.017 Started command progress : ffmpeg frame=  196 fps=0.8 q=28.0 size=     833kB time=00:00:05.88 bitrate=1160.9kbits/s dup=1 drop=179 speed=0.0243x    
47.019 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
47.517 Started command progress : ffmpeg     Last message repeated 2 times
47.524 Started command progress : ffmpeg frame=  197 fps=0.8 q=28.0 size=     833kB time=00:00:05.92 bitrate=1152.7kbits/s dup=1 drop=179 speed=0.0244x    
47.524 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
48.946 Started command progress : ffmpeg     Last message repeated 2 times
48.959 Started command progress : ffmpeg frame=  199 fps=0.8 q=28.0 size=     833kB time=00:00:06.00 bitrate=1136.7kbits/s dup=1 drop=180 speed=0.0246x    
48.961 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
49.797 Started command progress : ffmpeg     Last message repeated 1 times
49.798 Started command progress : ffmpeg frame=  200 fps=0.8 q=28.0 size=     833kB time=00:00:06.04 bitrate=1128.9kbits/s dup=1 drop=180 speed=0.0247x    
49.803 Started command progress : ffmpeg Error while decoding stream #2:1: Out of memory
50.546 Started command progress : ffmpeg     Last message repeated 4 times
50.547 Started command progress : ffmpeg frame=  201 fps=0.8 q=28.0 size=     833kB time=00:00:06.08 bitrate=1121.1kbits/s dup=1 drop=180 speed=0.0248x    
53.010 Started command progress : ffmpeg frame=  204 fps=0.8 q=28.0 size=     833kB time=00:00:06.21 bitrate=1098.6kbits/s dup=1 drop=181 speed=0.0251x    
53.713 Started command progress : ffmpeg frame=  205 fps=0.8 q=28.0 size=     833kB time=00:00:06.25 bitrate=1091.2kbits/s dup=1 drop=181 speed=0.0252x    
53.722 Started command progress : ffmpeg frame=  205 fps=0.8 q=28.0 size=     833kB time=00:00:06.25 bitrate=1091.2kbits/s dup=1 drop=181 speed=0.0251x    
50.706 Started command progress : ffmpeg frame=  205 fps=0.7 q=-1.0 Lsize=     965kB time=00:00:08.46 bitrate= 933.2kbits/s dup=1 drop=181 speed=0.0277x    
50.720 Started command progress : ffmpeg video:872kB audio:87kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.621844%
50.720 Started command progress : ffmpeg [libx264 @ 0xf35ff400] frame I:1     Avg QP:19.09  size: 40991
50.725 Started command progress : ffmpeg [libx264 @ 0xf35ff400] frame P:51    Avg QP:18.16  size: 10789
50.726 Started command progress : ffmpeg [libx264 @ 0xf35ff400] frame B:153   Avg QP:19.57  size:  1966
50.729 Started command progress : ffmpeg [libx264 @ 0xf35ff400] consecutive B-frames:  0.5%  0.0%  0.0% 99.5%
50.737 Started command progress : ffmpeg [libx264 @ 0xf35ff400] mb I  I16..4: 31.5% 61.8%  6.7%
50.742 Started command progress : ffmpeg [libx264 @ 0xf35ff400] mb P  I16..4:  2.3%  2.0%  0.1%  P16..4: 31.9%  5.7%  2.3%  0.0%  0.0%    skip:55.6%
50.750 Started command progress : ffmpeg [libx264 @ 0xf35ff400] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 18.2%  0.3%  0.0%  direct: 1.0%  skip:80.3%  L0:46.2% L1:53.2% BI: 0.6%
50.753 Started command progress : ffmpeg [libx264 @ 0xf35ff400] 8x8 transform intra:49.4% inter:92.4%
50.754 Started command progress : ffmpeg [libx264 @ 0xf35ff400] coded y,uvDC,uvAC intra: 19.1% 26.6% 3.8% inter: 2.5% 7.1% 0.0%
50.756 Started command progress : ffmpeg [libx264 @ 0xf35ff400] i16 v,h,dc,p: 41% 15%  5% 39%
50.764 Started command progress : ffmpeg [libx264 @ 0xf35ff400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 14% 32%  3%  5%  5%  4%  4%  3%
50.767 Started command progress : ffmpeg [libx264 @ 0xf35ff400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 20% 25%  2%  6%  4%  4%  2%  1%
50.768 Started command progress : ffmpeg [libx264 @ 0xf35ff400] i8c dc,h,v,p: 56% 20% 20%  4%
50.772 Started command progress : ffmpeg [libx264 @ 0xf35ff400] Weighted P-Frames: Y:0.0% UV:0.0%
50.774 Started command progress : ffmpeg [libx264 @ 0xf35ff400] ref P L0: 54.0%  5.5% 29.8% 10.6%
50.776 Started command progress : ffmpeg [libx264 @ 0xf35ff400] ref B L0: 76.8% 18.5%  4.7%
50.777 Started command progress : ffmpeg [libx264 @ 0xf35ff400] ref B L1: 96.2%  3.8%
50.779 Started command progress : ffmpeg [libx264 @ 0xf35ff400] kb/s:834.67
50.898 Started command progress : ffmpeg [aac @ 0xf35ffc00] Qavg: 1539.341
50.960 SUCCESS with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 4.8 (GCC)
    configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    libavutil      55. 17.103 / 55. 17.103
    libavcodec     57. 24.102 / 57. 24.102
    libavformat    57. 25.100 / 57. 25.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 31.100 /  6. 31.100
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/temp1.mp4':
    Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.25.100
    Duration: 00:00:05.55, start: 0.021333, bitrate: 191 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 360x360 [SAR 16:9 DAR 16:9], 113 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
        Metadata:
        handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 70 kb/s (default)
        Metadata:
        handler_name    : SoundHandler
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/temp2.mp4':
    Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.25.100
    Duration: 00:00:06.73, start: 0.021333, bitrate: 170 kb/s
        Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 360x360 [SAR 9:16 DAR 9:16], 90 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
        Metadata:
        handler_name    : VideoHandler
        Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 70 kb/s (default)
        Metadata:
        handler_name    : SoundHandler
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/temp3.mp4':
    Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.25.100
    Duration: 00:00:08.50, start: 0.021333, bitrate: 177 kb/s
        Stream #2:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 360x360 [SAR 9:16 DAR 9:16], 97 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
        Metadata:
        handler_name    : VideoHandler
        Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 70 kb/s (default)
        Metadata:
        handler_name    : SoundHandler
    [Parsed_amerge_7 @ 0xf38a7780] No channel layout for input 1
    [Parsed_amerge_7 @ 0xf38a7780] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
    [swscaler @ 0xf35f1000] deprecated pixel format used, make sure you did set range correctly
    [swscaler @ 0xf35e6000] deprecated pixel format used, make sure you did set range correctly
    No pixel format specified, yuvj420p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0xf35ff400] using SAR=16/9
    [libx264 @ 0xf35ff400] using cpu capabilities: none!
    [libx264 @ 0xf3
50.966 Finished command : ffmpeg [Ljava.lang.String;@7c54447

您正在使用 amerge 将 3 个单声道输入合并为一个 3 通道流。 ffmpeg 将其解释为 2.1 声道布局 (FL+FR+LFE)。 -ac 2 选项在缩混为立体声时忽略低频效果,因此第三个通道被丢弃。

一种方法是使用声像过滤器手动执行缩混。您没有指定哪些输入通道应该进入哪些输出通道,所以这个例子只是将它们全部放在每个输出通道中。

ffmpeg -i input0 -i input1 -i input2 -filter_complex \
"[0:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=green[a]; \
 [1:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=red[b]; \
 [2:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=blue[c]; \
 [b][c]hstack=inputs=2,scale=iw/2:-2[bottom]; \
 [a][bottom]vstack=inputs=2,scale=ih*2:-1,format=yuv420p[video]; \
 [0:a][1:a][2:a]amerge=inputs=3,pan=stereo|FL<c0+c1+c2|FR<c0+c1+c2[audio]" \
-map "[video]" -map "[audio]" -movflags +faststart output.mp4

ffmpeg -layouts 输出在处理音频通道时很有用。


与问题无关:我假设你想要 yuv420p 输出而不是 yuvj420p 所以我添加了格式过滤器并添加了 -movflags +faststart 因为我猜你将要展示通过渐进式下载视频。