
Estou executando umffmpegcomando para construir um vídeo: os primeiros 5 segundos são de introdução, o meio tem uma apresentação de slides de imagens com imagem de marca d'água sobreposta e 5 segundos de cena de saída com áudio na parte superior de todo o vídeo. Este processo tem funcionado. Mas, uma vez tentei executá-lo, através do erro:
Input link in2:v0 parameters (size 1282x720, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 1:1)
Aqui está o comando:
ffmpeg -y -t 5.000000 \
-loop 1 -i splash.png \
-i img-1.jpg \
-i img-2.jpg \
-i img-3.jpg \
-f lavfi -i color=black:r=25:s=1280x720:d=15.000000 \
-loop 1 -i watermark.png -t 5.000000 \
-loop 1 \
-i exit.png \
-i final.mp3 \
-filter_complex \
"[0:v]fade=t=in:st=0:d=0.500000,fade=t=out:st=4.500000:d=0.500000[splash]; \
[6:v]fade=t=in:st=0:d=0.500000,fade=t=out:st=4.500000:d=0.500000[end]; \
[1:v]scale=iw*max(1280*5/iw\,720*5/ih):ih*max(1280*5/iw\,720*5/ih):flags=lanczos,crop=1280*5:720*5,zoompan=z='min(zoom+0.0005,1.1)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d=125,setsar=1,setdar=16/9,setpts=PTS-STARTPTS[v1]; \
[2:v]scale=iw*max(1280*5/iw\,720*5/ih):ih*max(1280*5/iw\,720*5/ih):flags=lanczos,crop=1280*5:720*5,zoompan=z='min(zoom+0.0005,1.1)':x=0:y=2880:d=125,fade=t=in:st=0:d=0.500000:alpha=1,setsar=1,setdar=16/9,setpts=PTS-STARTPTS+5.000000/TB[v2]; \
[3:v]scale=iw*max(1280*5/iw\,720*5/ih):ih*max(1280*5/iw\,720*5/ih):flags=lanczos,crop=1280*5:720*5,zoompan=z='if(lte(zoom,1.0),1.1,max(1.001,zoom-0.0005))':x='iw/2-(iw/zoom/2)':y=0:d=125,fade=t=in:st=0:d=0.500000:alpha=1,setsar=1,setdar=16/9,setpts=PTS-STARTPTS+10.000000/TB[v3]; \
[4:v][v1]overlay[over1]; \
[over1][v2]overlay[over2]; \
[over2][v3]overlay[over3]; \
[over3][5:v]overlay=shortest=1,fade=t=in:st=0:d=0.500000,fade=t=out:st=14.500000:d=0.500000[main];\
[splash][main][end]concat=n=3:v=1:a=0[v]" \
-c:v libx264 -map [v] -crf 18 -map 7:a -shortest -pix_fmt yuv420p -preset ultrafast output.mp4
E a saída:
ffmpeg version 3.1.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-2) 20160904
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libzimg --cc=gcc-5 --disable-ffplay
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, png_pipe, from 'splash.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1280x720 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from 'img-1.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 85822 kb/s
Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 2560x1704 [SAR 1:1 DAR 320:213], 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from 'img-2.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 40378 kb/s
Stream #2:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 2560x1704 [SAR 1:1 DAR 320:213], 25 tbr, 25 tbn, 25 tbc
Input #3, image2, from 'img-3.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 43527 kb/s
Stream #3:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 2560x1708 [SAR 1:1 DAR 640:427], 25 tbr, 25 tbn, 25 tbc
Input #4, lavfi, from 'color=black:r=25:s=1280x720:d=15.000000':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #4:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #5, png_pipe, from 'watermark.png':
Duration: N/A, bitrate: N/A
Stream #5:0: Video: png, rgba(pc), 1280x720 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #6, png_pipe, from 'exit.png':
Duration: N/A, bitrate: N/A
Stream #6:0: Video: png, rgba(pc), 1282x720 [SAR 2835:2835 DAR 641:360], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #7, mp3, from 'final.mp3':
Metadata:
artist : Music 2 Hues
album : Vol. 23 Light Jazz
album_artist : Music 2 Hues
title : Dream River 60 Sec
encoded_by : iTunes v7.0.2.16
track : 26
genre : Jazz
encoder : Lavf57.41.100
Duration: 00:00:25.05, start: 0.025057, bitrate: 64 kb/s
Stream #7:0: Audio: mp3, 44100 Hz, mono, s16p, 64 kb/s
[swscaler @ 0x58a4280] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x59b9720] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x5aca920] deprecated pixel format used, make sure you did set range correctly
[Parsed_concat_30 @ 0x51d9b20] Input link in2:v0 parameters (size 1282x720, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 1:1)
[Parsed_concat_30 @ 0x51d9b20] Failed to configure output pad on Parsed_concat_30
Error configuring complex filters.
Invalid argument
2016/10/17 09:29:27 exit status 1
exit status 1
Existem imagens diferentes que são processadas usando este comando sempre, e é por isso que sar/dar é especificado no comando. E funcionou para todas as imagens que forneci até agora. Por que essas imagens gerariam esse erro de repente?
Responder1
Você exit.png
tem uma resolução diferente (1282x720) em comparação com outros fluxos (1280x720) e concat
o filtro não consegue fazer seu trabalho.
você pode dimensioná-lo para ser igual aos outros. para fazer isso, edite a segunda linha filter_complex
desta forma:
...[6:v]fade=t=in:st=0:d=0.500000,fade=t=out:st=4.500000:d=0.500000,scale=1280:720,setsar=1[end]; \ ...