Is there a script where I can convert ppt to mp4?

I want to convert a .ppt to .mp4 file with a script. Is this possible, if yes how can I start ?

Thanks for Ideas...

I know I can export directly over Microsoft Powerpoint but I want a script which does it by himself.


Solution 1:

First, install the following packages:

sudo apt update
sudo apt-get install unoconv ffmpeg imagemagick

Next, convert the ppt to pdf using the following command:

unoconv -f pdf filename.ppt

where you should replace filename.ppt with the actual file name of the power point presentation.

Then, convert the pdf to individual png files using imagemagick:

convert -density 400 filename.pdf picture.png

Again, replace filename.pdf with the actual filename of the pdf file when you run the command. Multiple png files will be automatically indexed by number.

Finally, run the following command to automatically convert the png files to an mp4 video:

ffmpeg -r 1/10 -i picture-%01d.png video.mp4

This is just a general explanation for the last command. Visit How To Create A Video From PDF Files In Linux - OSTechNix for more information. For example, the 1/10 specifies 10 seconds per image. Also, picture-%01d.png will work with under 10 image files. For more than 9 but less than 100 files, you would use picture-%02d.png instead. For more than 99 but less than 1000 files, use picture-%03d.png etc.


EDIT:

If you get a convert error see here and here or run the following command:

sudo sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/;s/1GiB/4GiB/' /etc/ImageMagick-6/policy.xml

EDIT EDIT:

If you are having trouble playing the video, install the following packages:

sudo apt update
sudo apt install ubuntu-restricted-extras gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-clutter-3.0 gstreamer1.0-crystalhd gstreamer1.0-doc gstreamer1.0-espeak gstreamer1.0-fluendo-mp3 gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-libav gstreamer1.0-libav-dbg gstreamer1.0-nice gstreamer1.0-omx-bellagio-config gstreamer1.0-omx-generic gstreamer1.0-omx-generic-config gstreamer1.0-packagekit gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-doc gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg gstreamer1.0-plugins-good-doc gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg gstreamer1.0-plugins-ugly-doc gstreamer1.0-pocketsphinx gstreamer1.0-pulseaudio gstreamer1.0-qt5 gstreamer1.0-rtsp gstreamer1.0-rtsp-dbg gstreamer1.0-tools gstreamer1.0-vaapi gstreamer1.0-vaapi-doc gstreamer1.0-x libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0 libgstreamer1.0-0 libgstreamer1.0-dev libgstreamermm-1.0-1 libreoffice-avmedia-backend-gstreamer

Also, I tested this using the totem media player so you might want to try using that player:

sudo apt update
sudo apt install gir1.2-totem-1.0 gir1.2-totemplparser-1.0 libtotem-plparser-common libtotem-plparser-videosite libtotem-plparser18 libtotem0 totem totem-common totem-plugins