L
L
Lexx Xell2020-08-13 14:21:22
fmpeg
Lexx Xell, 2020-08-13 14:21:22

Why doesn't ffmpeg stretch the image?

You need to put the picture on the music. The picture is square 1080x1080. It needs to be stretched to 1920x1080. I use filter_complex because I will add more filters in the future.

ffmpeg -y -i "music.mp3" -loop 1 -i "img.jpg" \
    -filter_complex "[1:v]scale=1920:1080[out]" \
    -map "[out]" \
    -map 0:a \
    -shortest -acodec copy \
    -c:v libx264 -b:v 6M -minrate 6M -maxrate 6M -bufsize 12M \
    -preset medium -r 30 -pix_fmt yuv420p -tune stillimage -crf 19 -movflags faststart \
    "out.mp4"

At the output, I expect to see:
5f3520c6ca932132504062.png

In fact, I see:
5f351fb238e1f654734709.png

Video resolution, however, 1920x1080, but padding around the edges.

What am I doing wrong?

ffmpeg version N-98692-ga5ac819 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/home/lexx/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/lexx/ffmpeg_build/include --extra-ldflags=-L/home/lexx/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/lexx/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil      56. 58.100 / 56. 58.100
libavcodec     58.100.100 / 58.100.100
libavformat    58. 50.100 / 58. 50.100
libavdevice    58. 11.101 / 58. 11.101
libavfilter     7. 87.100 /  7. 87.100
libswscale      5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100
libpostproc    55.  8.100 / 55.  8.100

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-08-15
@LexxXell

I tried it on a fresh ffmpeg master, it jars.

ffmpeg -i logo.png -filter_complex "[0:v]scale=1920:1080[out]" -map '[out]' out.png
. It was a square logo, it became rectangular. However, the display aspect ratio remained at 1, while the pixel aspect ratio changed to 0.56:
Width                                    : 1920
Width                                    : 1 920 pixels
Height                                   : 1080
Height                                   : 1 080 pixels
Stored_Height                            : 1088
Sampled_Width                            : 1920
Sampled_Height                           : 1080
Pixel aspect ratio                       : 0.562
Display aspect ratio                     : 0.999
Display aspect ratio                     : 0.999
Original display aspect ratio            : 1.000
Original display aspect ratio            : 1.000

Adding -aspect 1.7778solves the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question