I have 1000 PNGs created with R and ggplot2. This is one for example: image000.png

Now I use ffmpeg to glue them together into a clip:

ffmpeg -r 10 -i image%03d.png -s 1380x720 -vcodec png 
       -qscale 10 -r 30 daimler_man.mov
  • input frame rate 10 and output frame rate 30 which leads to 10 different images per second with a video frame rate of 30.

  • the images are originally sized 1380 x 720.

  • vcodec png ... well it works at least. when I used h264 the video looked nice on my computer but youtube turned the whole clip gray.

  • qscale 10 ... I am not sure if this one is optimally chosen.

Everything is fine more or less but when I take the embed code of the youtube clip then the displayed preview image looks like this:

enter image description here

The background color of plot area is now gray instead of light brown!?

the ffmpeg output:

C:\Users\Raffael\Documents\proj>ffmpeg -r 10 -i image%03d.png -s 1380x720 -vcodec png -qscale 10 -r 30 daimler_man.mov
ffmpeg version N-48785-g2ea3f37 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 12 2013 20:45:33 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-l
ibopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwol
ame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 14.100 / 52. 14.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.107 / 54. 59.107
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, image2, from 'image%03d.png':
  Duration: 00:00:02.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgb24, 1380x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
Please use -q:a or -q:v, -qscale is ambiguous
File 'daimler_man.mov' already exists. Overwrite ? [y/N] y
Output #0, mov, to 'daimler_man.mov':
    encoder         : Lavf54.59.107
    Stream #0:0: Video: png (png  / 0x20676E70), rgb24, 1380x720, q=2-31, 200 kb/s, 15360 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> png)
Press [q] to stop, [?] for help
frame=  151 fps= 26 q=0.0 Lsize=   13037kB time=00:00:05.03 bitrate=21218.1kbits/s dup=100 drop=0
video:13035kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.010533%

YouTube has very specific encoding requirements. I wouldn't be surprised if it couldn't handle a stream of PNG images in a MOV container, when it actually expects H.264 video (ideally in MP4).

Since YouTube re-encodes whatever you upload to it, it will apply some filters to your video to make it fit. The PNGs come as non-subsampled 4:4:4 images, with an RGB 24-bit color space. H.264 video is usually encoded in a different color space, namely YUV.

YouTube might have simply applied the wrong conversion there when going from RGB to YUV, which is why your light brown (it's actually light grey; check your monitor calibration) background into dark grey.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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