Add a pad problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Add a pad problem

Anders Arveryd
Hi,
I'm new with ffmpeg, and trying to make a slideshow of some images. It works fine, but when I have a vertical image, I want to add a pad around to keep the 3/2 ratio. Then I get this error message and I can't figure it out what is wrong, its something about the dimensions but what? It has a slow zoompan and transitions between image. All that works fine.


The problem is this: pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,

It doesn't help if I change to: pad=2000:1333:(ow-iw)/2:(oh-ih)/2,

If I removes the pad part then it works but the vertical images are stretched out.


The command:
ffmpeg -i img1.jpg -i img2.jpg -i img3.jpg -i img4.jpg -filter_complex "color=c=white:r=60:size=2000x1333:d=21[black];[0:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='0':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=0,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS[v0];[1:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='iw-iw/zoom':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS+1*5/TB[v1];[2:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='0':y='ih-ih/zoom':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS+2*5/TB[v2];[3:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=x='0':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+3*5/TB[v3];[black][v0]overlay[ov0];[ov0][v1]overlay[ov1];[ov1][v2]overlay[ov2];[ov2][v3]overlay=format=yuv420" -c:v libx264 -y out.mp4

Ffmpeg output:
ffmpeg version N-97033-gc455a28 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
  configuration: --pkg-config-flags=--static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-libfreetype --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 42.101 / 56. 42.101
  libavcodec     58. 76.100 / 58. 76.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, image2, from 'img1.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1088252 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from 'img2.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1145221 kb/s
    Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from 'img3.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 965134 kb/s
    Stream #2:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
Input #3, image2, from 'img4.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1819752 kb/s
    Stream #3:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 5315x3543, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (mjpeg) -> format
  Stream #1:0 (mjpeg) -> format
  Stream #2:0 (mjpeg) -> format
  Stream #3:0 (mjpeg) -> format
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 0x3951b00] deprecated pixel format used, make sure you did set range correctly
[Parsed_pad_3 @ 0x3938c40] Padded dimensions cannot be smaller than input dimensions.
[Parsed_pad_3 @ 0x3938c40] Failed to configure input pad on Parsed_pad_3
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #3:0
Conversion failed!


# END

Thanks in advance for any help!

Best regards
Anders
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Add a pad problem

Anders Arveryd
I have sorted this out now! So no need to spend time to solve this!

Best regards
Anders

> 26 apr. 2020 kl. 11:39 skrev Anders Arveryd <[hidden email]>:
>
> Hi,
> I'm new with ffmpeg, and trying to make a slideshow of some images. It works fine, but when I have a vertical image, I want to add a pad around to keep the 3/2 ratio. Then I get this error message and I can't figure it out what is wrong, its something about the dimensions but what? It has a slow zoompan and transitions between image. All that works fine.
>
>
> The problem is this: pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,
>
> It doesn't help if I change to: pad=2000:1333:(ow-iw)/2:(oh-ih)/2,
>
> If I removes the pad part then it works but the vertical images are stretched out.
>
>
> The command:
> ffmpeg -i img1.jpg -i img2.jpg -i img3.jpg -i img4.jpg -filter_complex "color=c=white:r=60:size=2000x1333:d=21[black];[0:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='0':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=0,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS[v0];[1:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='iw-iw/zoom':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS+1*5/TB[v1];[2:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=z='if(eq(on,1),1,zoom+0.00025)':x='0':y='ih-ih/zoom':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,fade=t=out:st=5:d=1:alpha=1,setpts=PTS-STARTPTS+2*5/TB[v2];[3:v]format=pix_fmts=yuva420p,pad=ih*1.5:ih:(ow-iw)/2:(oh-ih)/2,zoompan=x='0':y='0':fps=60:d=60*6:s=2000x1333,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+3*5/TB[v3];[black][v0]overlay[ov0];[ov0][v1]overlay[ov1];[ov1][v2]overlay[ov2];[ov2][v3]overlay=format=yuv420" -c:v libx264 -y out.mp4
>
> Ffmpeg output:
> ffmpeg version N-97033-gc455a28 Copyright (c) 2000-2020 the FFmpeg developers
>  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
>  configuration: --pkg-config-flags=--static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-libfreetype --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
>  libavutil      56. 42.101 / 56. 42.101
>  libavcodec     58. 76.100 / 58. 76.100
>  libavformat    58. 42.100 / 58. 42.100
>  libavdevice    58.  9.103 / 58.  9.103
>  libavfilter     7. 77.100 /  7. 77.100
>  libswscale      5.  6.101 /  5.  6.101
>  libswresample   3.  6.100 /  3.  6.100
>  libpostproc    55.  6.100 / 55.  6.100
> Input #0, image2, from 'img1.jpg':
>  Duration: 00:00:00.04, start: 0.000000, bitrate: 1088252 kb/s
>    Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
> Input #1, image2, from 'img2.jpg':
>  Duration: 00:00:00.04, start: 0.000000, bitrate: 1145221 kb/s
>    Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
> Input #2, image2, from 'img3.jpg':
>  Duration: 00:00:00.04, start: 0.000000, bitrate: 965134 kb/s
>    Stream #2:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2453x3680, 25 tbr, 25 tbn, 25 tbc
> Input #3, image2, from 'img4.jpg':
>  Duration: 00:00:00.04, start: 0.000000, bitrate: 1819752 kb/s
>    Stream #3:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 5315x3543, 25 tbr, 25 tbn, 25 tbc
> Stream mapping:
>  Stream #0:0 (mjpeg) -> format
>  Stream #1:0 (mjpeg) -> format
>  Stream #2:0 (mjpeg) -> format
>  Stream #3:0 (mjpeg) -> format
>  overlay -> Stream #0:0 (libx264)
> Press [q] to stop, [?] for help
> [swscaler @ 0x3951b00] deprecated pixel format used, make sure you did set range correctly
> [Parsed_pad_3 @ 0x3938c40] Padded dimensions cannot be smaller than input dimensions.
> [Parsed_pad_3 @ 0x3938c40] Failed to configure input pad on Parsed_pad_3
> Error reinitializing filters!
> Failed to inject frame into filter network: Invalid argument
> Error while processing the decoded data for stream #3:0
> Conversion failed!
>
>
> # END
>
> Thanks in advance for any help!
>
> Best regards
> Anders
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".