0 down vote favorite I am merging an image with a video, my command looks like this:

ffmpeg -i background.mpg -i Menu.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,30)'" -pix_fmt yuv420p -c:a copy merge1.mpg

That works, but something strange happens.

If I run that merged video it continuously looses quality at each second, at the first few seconds the quality is ok but later on it looses quality(the resolution becomes worse).

Any ideas of how this is happening and maybe solutions?


I specified a bitrate like Mulvya suggest me to do:

Command looks like this now:

ffmpeg -i background.mpg -i Menu.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,30)'" -pix_fmt yuv420p -b:v 2000k -c:a copy merge1.mpg

Console ouput:

ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfr
eetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enab
le-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from 'C:\xampp\htdocs\myApp\storage\generator\projects\dvdrom\Ged\Menus\background.mpg':
  Duration: 00:00:30.00, start: 0.540000, bitrate: 1792 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 1800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Input #1, png_pipe, from 'C:\xampp\htdocs\myApp\storage\generator\projects\dvdrom\Ged\Menus\imageSel.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 720x480 [SAR 2835:2835 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
File 'C:\xampp\htdocs\myApp\storage\generator\projects\dvdrom\Ged\Menus\image1.mpg' already exists. Overwrite ? [y/N] y
[mpeg @ 04dca7e0] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'C:\xampp\htdocs\myApp\storage\generator\projects\dvdrom\Ged\Menus\image1.mpg':
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mpeg1video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 2000 kb/s, 25 fps, 90k tbn, 25 tbc (default)
      encoder         : Lavc56.60.100 mpeg1video
Stream mapping:
  Stream #0:0 (mpeg2video) -> overlay:main
  Stream #1:0 (png) -> overlay:overlay
  overlay -> Stream #0:0 (mpeg1video)
Press [q] to stop, [?] for help
frame=  750 fps=443 q=2.0 Lsize=    5650kB time=00:00:29.96 bitrate=1544.9kbits/s
video:5624kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.468742%
  • It's defaulting to a bitrate of 200k. Specify a rate e.g. -b:v 2000k
    – Gyan
    Aug 19, 2016 at 8:31
  • @Mulvya I tried it out did not solve the issue
    – utdev
    Aug 19, 2016 at 8:51
  • Show the full console output
    – Gyan
    Aug 19, 2016 at 9:01
  • That's not the full console output. Anyway, add -c:v mpeg2video -bufsize 2000k
    – Gyan
    Aug 19, 2016 at 9:10
  • sorry, I somehow though to post just the error message. Shall I remove -c:a ?
    – utdev
    Aug 19, 2016 at 9:12

1 Answer 1


Looks like you're aiming for DVD-spec output. By default, FFmpeg encodes to MPEG-1 video into a MPEG-1 program stream, when the output extension is .mpg. You can force MPEG-2 DVD by specifying -f dvd. And for a standard like PAL, set -target pal-dvd


ffmpeg -i background.mpg -i Menu.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,30)'" -pix_fmt yuv420p -target pal-dvd -f dvd merge1.mpg
  • What about quality output without considering the output type For example I wanted to merge mp4 videos and my target is also mp4 then what should I write for better quality??@Mulvya Dec 11, 2017 at 11:51
  • 1
    For MP4 output, remove -target option. ffmpeg will automatically set output to CRF 23.
    – Gyan
    Dec 11, 2017 at 13:03
  • Thanks for the reply but can u plz tell me about high quality let me post my command and u do check that!! Dec 12, 2017 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.