Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a video from PDF in Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to create a video from PDF in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Create a video from PDF in Linux

To do this, you need to install "FFMpeg" and "ImageMagick" on your system.

To install FFMpeg, refer to the link below.

Install FFMpeg on Linux

Imagemagick can be found in the official repository of most Linux distributions.

On Arch Linux and derivatives such as Antergos and Manjaro Linux, run the following command to install.

Sudo pacman-S imagemagick

Debian 、 Ubuntu 、 Linux Mint:

Sudo apt-get install imagemagick

Fedora:

Sudo dnf install imagemagick

RHEL 、 CentOS 、 Scientific Linux:

Sudo yum install imagemagick

SUSE 、 openSUSE:

Sudo zypper install imagemagick

After installing ffmpeg and imagemagick, convert your PDF file to an image format, such as PNG or JPG, as shown below.

Convert-density 400input.pdf picture.png

Here,-density 400 specifies the horizontal resolution of the output image.

The above command converts all pages of the specified PDF to PNG format. Each page in PDF will be converted into a PNG file and saved in the current directory with the file name: picture-1.png, picture-2.png, and so on. Depending on the number of pages selected for PDF, this will take some time.

After converting all pages in PDF to PNG format, run the following command to create a video file from PNG.

Ffmpeg-r 1max 10-I picture-d.png-c libx264 v libx264-r 30-pix_fmt yuv420p video.mp4

Here:

-r 1ax 10: each image is displayed for 10 seconds.

-I picture-d.png: reads all pictures that start with picture-, followed by a digit (% 01d), and * * end with .png. If the picture name has a 2-digit number (that is, picture-10.png, picture11.png, etc.), use (% 02d) in the above command.

-CRV libx264: the output video encoder (i.e. h364).

-r 30: frame rate of output video

-pix_fmt yuv420p: output video resolution

Video.mp4: outputs video files in .mp4 format.

All right, the video file is complete! You can play it on any device that supports the .mp4 format. Next, I need to find a way to insert a cool music into my video. I hope it's not difficult.

If you want higher resolution, you don't have to start over. Just convert the output video file to any other higher / lower resolution you choose, such as 720p, as shown below.

Ffmpeg-I video.mp4-vf scale=-1:720 video_720p.mp4

Note that creating a video using ffmpeg requires a configured PC. Ffmpeg consumes a lot of system resources when converting video.

This is the end of the article on "how to create a video from PDF in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 248

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report