[FFmpeg-user] Having a hard time getting good results with mpeg2video
Ferdi Scholten
ferdi at sttc-nlp.nl
Tue Jan 9 01:09:43 EET 2024
Hi,
>
> I'm trying to make a DVD with a still image (1:1 aspect ratio) and
> audio, the only issue is that the video is a bit blocky even after
> setting the highest bitrate available.
>
>
> The command used:
>
> `ffmpeg -i image.jpg -i audiofile.wav -f dvd -muxrate 10080k
> -packetsize 2048 -pix_fmt yuv420p -r 24000/1001 -codec:v mpeg2video -g
> 18 -b:v 9800k -maxrate:v 9800k -minrate:v 9800k -bufsize:v 1835008 -vf
> "scale=720:576:flags=lanczos:force_original_aspect_ratio=decrease,pad=720:576:(ow-iw)/2:(oh-ih)/2"
> -codec:a pcm_dvd output.mpg`
>
>
> FFmpeg version (latest from Arch repos):
>
> `ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
> built with gcc 13.2.1 (GCC) 20230801
> configuration: --prefix=/usr --disable-debug --disable-static
> --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm
> --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp
> --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d
> --enable-libdrm --enable-libfreetype --enable-libfribidi
> --enable-libgsm --enable-libharfbuzz --enable-libiec61883
> --enable-libjack --enable-libjxl --enable-libmodplug
> --enable-libmp3lame --enable-libopencore_amrnb
> --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt
> --enable-libopus --enable-libplacebo --enable-libpulse
> --enable-librav1e --enable-librsvg --enable-librubberband
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2
> --enable-libvidstab --enable-libvmaf --enable-libvorbis
> --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl
> --enable-opengl --enable-shared --enable-version3 --enable-vulkan
> libavutil 58. 29.100 / 58. 29.100
> libavcodec 60. 31.102 / 60. 31.102
> libavformat 60. 16.100 / 60. 16.100
> libavdevice 60. 3.100 / 60. 3.100
> libavfilter 9. 12.100 / 9. 12.100
> libswscale 7. 5.100 / 7. 5.100
> libswresample 4. 12.100 / 4. 12.100
> libpostproc 57. 3.100 / 57. 3.100`
>
>
> I also played around with some hidden options but they didn't seem to
> make much difference:
>
> `-trellis 1 -dia_size 2 -pre_dia_size 2 -precmp rd -cmp rd -subcmp rd
> -mbd rd -last_pred 3 -vqmin 0 -vqmax 0 -qmin 1 -qmax 1 -dc 11 -vstrict
> 0 -mpv_flags '+mv0+cbp_rd+qp_rd' -lmin 1`
>
You do not need a high bitrate for still images. Just use the defaults!
Higher bitrates are only necessary for video with lots of movement. Use
dedicated imaging software to scale the images to the size you need
first. For example use Imagemagick or The Gimp for this, they have much
better image scaling algorithms giving you a high quality scaled image.
Then use those already scaled images as input for your video. This will
most likely give a much better result. And a simpler commandline as you
can completely omit the scale filter. So the only thing ffmpeg has to do
is to convert your picture to the specified yuv colorspace.
The ffmpeg scale filter is according to the documentation a "video
scaling filter" meaning it is designed to scale moving pictures, not
still pictures, For video some blocking or blurring often does not hurt
or even benefits the perceived quality.
More information about the ffmpeg-user
mailing list