1

I have a bunch of pdf files, from which I want to produce a movie.

I'm using sips (on Mac OS) to convert the pdfs to .png, and then produce the movie with ffmpeg.

So far, I'm doing this:

for i in {2..9087}
do 
sips -z 1024 -s format png fig${i}.pdf --out png/fig${i}.png
done

followed by

ffmpeg -qscale 5 -r 20 -b 9600 -i fig%d.png movie.mp4

However, I found that ffmpeg is struggling with the transparency of .png (it renders the movie with blured things). I've read that it is advisable to input the ffmpeg with non-transparent .pngs. So, my workflow has a flaw, since sips apparently does not have a way of exporting non-transparent pngs from pdf.

I'm wonder if anyone already solved this problem, and would like to share the solution.

2
  • Looks like you need another intermediary step, take the transparent PNG from sips, and then convert them to non-transparent in another, as yet identified package.
    – Steve
    Feb 5, 2013 at 12:15
  • Can't you just use an image format that does not support transparency, like jpg?
    – terdon
    Feb 5, 2013 at 12:51

1 Answer 1

1

As I said in my comment, the easiest way would be to simply use a file format that does not support transparency, .jpg for example. If you need to stick to .png, you can use convert from the ImageMagick suite to remove the transparency:

for i in {2..9087}
do 
   sips -z 1024 -s format png fig${i}.pdf --out png/fig${i}.png
   convert png/fig${i}.png -background=white -flatten +matte aa.png && 
   mv aa.png png/fig${i}.png
done
1
  • Thanks. funny solution but works (the jpeg). The convert tool not so much: it is really slow compared to sips. Feb 5, 2013 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .