Score:2

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

nr flag

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.

vanadium avatar
cn flag
IS this related to Ubuntu?
kemal uluz avatar
nr flag
any os ... have you an idea?
Nate T avatar
it flag
He or she added the [bash] tag.. At least we can assume it's Linux. XD
mchid avatar
bo flag
Yeah, there's lots of stuff you can do on any OS. However, the answers provided will only include instructions for Ubuntu.
Score:3
bo flag

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
kemal uluz avatar
nr flag
How can I change the policy because the operation is not allowed if I type convert -density .....
kemal uluz avatar
nr flag
Ok. Policy done. Problem now is that the terminal is given an error by initializing at output stream .. maybe incorrect parameters such as bit_rate......and so on
mchid avatar
bo flag
Is it a [cache error](https://stackoverflow.com/questions/31407010/cache-resources-exhausted-imagemagick)? If so, run `sudo sed -i 's/1GiB/4GiB/' /etc/ImageMagick-6/policy.xml` and then try again. If you get the cache error again, you can increase like this and try again `sudo sed -i 's/4GiB/8GiB/' /etc/ImageMagick-6/policy.xml`
kemal uluz avatar
nr flag
I don´t have the policy problem anymore. I can´t convert to .mp4 because of the error "width not divisible by 2" (5333x3000)
mchid avatar
bo flag
What's the exact error?
kemal uluz avatar
nr flag
width not divisible by 2 (5333x3000) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
vanadium avatar
cn flag
Se here https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert/1081907#1081907 on how to tame Imagemagicks convert.
mchid avatar
bo flag
@kemaluluz https://stackoverflow.com/a/60793196
kemal uluz avatar
nr flag
@mchid I tried but the only think is it doesn´t show me up the video. it converts but nothing happens.
kemal uluz avatar
nr flag
@mchid ffmpeg -i test1-%01d.png -vf "format=yuv444p,scale:375:500" -c:a copy test.mp4
mchid avatar
bo flag
@kemaluluz `ffmpeg -r 1/10 -i picture-%01d.png video.mp4` works without error.
kemal uluz avatar
nr flag
it converts yes but doesn´t show me up the video .. why ?
mchid avatar
bo flag
@kemaluluz Did you try my command? It works for me.
kemal uluz avatar
nr flag
I tried now. it converts but doesn´t play it up. It opens vlc but don´t play.
mchid avatar
bo flag
@kemaluluz I'm not sure. Try a different player.
kemal uluz avatar
nr flag
I tried now. Only green screen :/
mchid avatar
bo flag
@kemaluluz Sounds like you need to install [restricted extras](https://help.ubuntu.com/community/RestrictedFormats) and possibly [these gstreamer packages](https://askubuntu.com/questions/590578/green-screen-on-totem-when-playing-mp4-files) as well.
kemal uluz avatar
nr flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/127231/discussion-between-kemal-uluz-and-mchid).
kemal uluz avatar
nr flag
I tried it now with ubuntu and the problem is it takes some time to convert and afterwards it doesn´t play the video
mchid avatar
bo flag
@kemaluluz What video player are you using? I tried with the ffmpeg command you used and it didn't play but when using the commands in the answer and the totem video player and it works. Make sure you have the [restricted extras](https://help.ubuntu.com/community/RestrictedFormats) installed and [these gstreamer packages](https://askubuntu.com/questions/590578/green-screen-on-totem-when-playing-mp4-files) installed as well.
mchid avatar
bo flag
I added some commands. It might be a bit of overkill on installing all those gstreamer packages but it won't hurt unless you're lacking disk space.
kemal uluz avatar
nr flag
@mchid I tried your commands to install the packages but it isn´t working. For example it tells me that gir1.2-totem-1.0:amd64 isn´t a package to install I tried without amd64 it installs but doesn´t help me a lot
mchid avatar
bo flag
@kemaluluz I changed the install command. Like I said, I tried your ffmpeg command and the video did not play but using my command it did. Please open a new question if the video doesn't play; this is really a separate question. I've tested this on my system and it works. Thanks.
ADBeveridge avatar
lb flag
Somebody should make a program that does all of this. I think I will.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.