问题描述
我不明白为什么它不起作用.我试图使用[0:v]/[0:1]/[0:v:0]和[音频流为[0:a]/[0:0]/[0:0:0].没有任何作用.
I am not getting why this isn't working.. I have tried to get the video streams with [0:v]/[0:1]/[0:v:0] & the audio streams with [0:a]/[0:0]/[0:0:0].nothing worked.
解释输入内容:
1.1st输入流是一个视频,该视频可以具有不同的分辨率,过滤器在该视频上添加填充以使其达到600:480.
1.1st input stream is a video that can be of varying resolution on which the filter adds a padding on to make it 600:480.
2.2nd输入是一个已经以5:4的比例叠加的png.在将其叠加到滤镜之前,只需将其设为600:480即可.
2.2nd input is an overlay png which is already at 5:4 ratio.. just making it 600:480 before it gets overlaid in the filter.
3.3rd&第4个也是我不在乎的视频,如果它们被拉长到600:480.
3.3rd & 4th ones are also videos which I don't care if they get stretched.. n they are getting stretched to 600:480.
4.so最后有3个流1需要叠加的视频2个拉伸的视频.
4.so finally there are 3 streams 1 overlaid video 2 stretched videos which needs to be concatenated.
这是命令:
ffmpeg
-i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612.mp4'
-i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_overlay.png'
-i '/home/vidinflux/public_html/assets/user/736/video/Lines1.mp4'
-i '/home/vidinflux/public_html/assets/user/736/video/Lines11.mp4'
-filter_complex
"[0:v]trim=0:138,setpts=PTS-STARTPTS[v0];[0:a]atrim=0:138,asetpts=PTS-STARTPTS[a0];[v0]scale='gte(iw/ih\,600/480)*600+lt(iw/ih\,600/480)*((480*iw)/ih):lte(iw/ih\,600/480)*480+gt(iw/ih\,600/480)*((600*ih)/iw)',pad='600:480:(600-gte(iw/ih\,600/480)*600-lt(iw/ih\,600/480)*((480*iw)/ih))/2:(480-lte(iw/ih\,600/480)*480-gt(iw/ih\,600/480)*((600*ih)/iw))/2:black'[x];[1:v]scale=600:480[y];[x][y]overlay=0:0[z];[2:v]scale=600:480,setsar=1:1[x0];[3:v]scale=600:480,setsar=1:1[x1];[x0][2:a][z][a0][x1][3:a]concat=n=3:v=1:a=1[v][a]"
-map "[v]"
-map "[a]"
-c:v libx264
-shortest /home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_final.mp4
这是我得到的完整错误:
this is the complete error I am getting :
Stream specifier ':a' in filtergraph description [0:v]trim=0:138,setpts=PTS-STARTPTS[v0];[0:a]atrim=0:138,asetpts=PTS-STARTPTS[a0];[v0]scale='gte(iw/ih\,600/480)*600+lt(iw/ih\,600/480)*((480*iw)/ih):lte(iw/ih\,600/480)*480+gt(iw/ih\,600/480)*((600*ih)/iw)',pad='600:480:(600-gte(iw/ih\,600/480)*600-lt(iw/ih\,600/480)*((480*iw)/ih))/2:(480-lte(iw/ih\,600/480)*480-gt(iw/ih\,600/480)*((600*ih)/iw))/2:black'[x];[1:v]scale=600:480[y];[x][y]overlay=0:0[z];[2:v]scale=600:480,setsar=1:1[x0];[3:v]scale=600:480,setsar=1:1[x1];[x0][2:a][z][a0][x1][3:a]concat=n=3:v=1:a=1[v][a] matches no streams.
也有这些警告:
[Parsed_setsar_9 @ 0x219fba0] num:den syntax is deprecated, please use num/den or named options instead
[Parsed_setsar_11 @ 0x21a4840] num:den syntax is deprecated, please use num/den or named options instead
根据要求完成日志:
[root@cloud ~]# ffmpeg -i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612.mp4' -i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_overlay.png' -i '/home/vidinflux/public_html/assets/user/736/video/Lines1.mp4' -i '/home/vidinflux/public_html/assets/user/736/video/Lines11.mp4' -filter_complex \ "[0:v]trim=0:138,setpts=PTS-STARTPTS[v0];[0:a]atrim=0:138,asetpts=PTS-STARTPTS[a0];[v0]scale='gte(iw/ih\,600/480)*600+lt(iw/ih\,600/480)*((480*iw)/ih):lte(iw/ih\,600/480)*480+gt(iw/ih\,600/480)*((600*ih)/iw)',pad='600:480:(600-gte(iw/ih\,600/480)*600-lt(iw/ih\,600/480)*((480*iw)/ih))/2:(480-lte(iw/ih\,600/480)*480-gt(iw/ih\,600/480)*((600*ih)/iw))/2:black'[x];[1:v]scale=600:480[y];[x][y]overlay=0:0[z];[2:v]scale=600:480,setsar=1:1[x0];[3:v]scale=600:480,setsar=1:1[x1];[x0][2:a][z][a0][x1][3:a]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -shortest /home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_final.mp4
ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-08-21 02:23:24
Duration: 00:02:17.23, start: 0.000000, bitrate: 417 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 318 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
creation_time : 2017-08-21 02:23:24
handler_name : IsoMedia File Produced by Google, 5-11-2011
Input #1, png_pipe, from '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_overlay.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba, 600x479, 25 tbr, 25 tbn, 25 tbc
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/home/vidinflux/public_html/assets/user/736/video/Lines1.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2018-01-31 22:40:09
Duration: 00:00:04.90, start: 0.103811, bitrate: 846 kb/s
Stream #2:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 1920x1080, 827 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2018-01-31 22:40:10
handler_name : Core Media Video
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '/home/vidinflux/public_html/assets/user/736/video/Lines11.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2018-01-31 22:40:09
Duration: 00:00:04.90, start: 0.103811, bitrate: 846 kb/s
Stream #3:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 1920x1080, 827 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2018-01-31 22:40:10
handler_name : Core Media Video
[Parsed_setsar_9 @ 0x17c8ba0] num:den syntax is deprecated, please use num/den or named options instead
[Parsed_setsar_11 @ 0x17cd840] num:den syntax is deprecated, please use num/den or named options instead
Stream specifier ':a' in filtergraph description [0:v]trim=0:138,setpts=PTS-STARTPTS[v0];[0:a]atrim=0:138,asetpts=PTS-STARTPTS[a0];[v0]scale='gte(iw/ih\,600/480)*600+lt(iw/ih\,600/480)*((480*iw)/ih):lte(iw/ih\,600/480)*480+gt(iw/ih\,600/480)*((600*ih)/iw)',pad='600:480:(600-gte(iw/ih\,600/480)*600-lt(iw/ih\,600/480)*((480*iw)/ih))/2:(480-lte(iw/ih\,600/480)*480-gt(iw/ih\,600/480)*((600*ih)/iw))/2:black'[x];[1:v]scale=600:480[y];[x][y]overlay=0:0[z];[2:v]scale=600:480,setsar=1:1[x0];[3:v]scale=600:480,setsar=1:1[x1];[x0][2:a][z][a0][x1][3:a]concat=n=3:v=1:a=1[v][a] matches no streams.
推荐答案
您的其他输入没有音频.必须提供虚拟音频.
Your other inputs don't have audio. A dummy audio has to be supplied.
ffmpeg \
-i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612.mp4' \
-i '/home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_overlay.png' \
-i '/home/vidinflux/public_html/assets/user/736/video/Lines1.mp4' \
-i '/home/vidinflux/public_html/assets/user/736/video/Lines11.mp4' \
-f lavfi -t 0.1 -i anullsrc \
-filter_complex \
"[0:v]trim=0:138,setpts=PTS-STARTPTS[v0]; \
[0:a]atrim=0:138,asetpts=PTS-STARTPTS[a0]; \
[v0]scale='gte(iw/ih\,600/480)*600+lt(iw/ih\,600/480)*((480*iw)/ih):lte(iw/ih\,600/480)*480+gt(iw/ih\,600/480)*((600*ih)/iw)',pad='600:480:(600-gte(iw/ih\,600/480)*600-lt(iw/ih\,600/480)*((480*iw)/ih))/2:(480-lte(iw/ih\,600/480)*480-gt(iw/ih\,600/480)*((600*ih)/iw))/2:black'[x];[1:v]scale=600:480[y];[x][y]overlay=0:0[z];[2:v]scale=600:480,setsar=1:1[x0];[3:v]scale=600:480,setsar=1:1[x1];[x0][4:a][z][a0][x1][4:a]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -shortest /home/vidinflux/public_html/assets/temp/2018020116464612/2018020116464612_final.mp4
这篇关于ffmpeg版本2.6.8:滤镜描述中的流说明符':a'不匹配任何流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!