ffmpeg相关操作参考点这儿
-
视频截取gif 参考这儿
ffmpeg -ss 00:00:20 -i sample.mp4 -to 10 -r 10 -vf scale=200:-1 cutekid_cry.gif
- ss : indicates the starting point of GIF
- i : input file sample.mp4 : My video file name
- to : End position of the GIF file
- r : frame rate. You can increase the value to get more quality GIF file
- vf : filter graph. To scale the GIF image in the desired size.
-
播放视频
ffplay audio.mp3
-
PDF转视频 参考这儿
-
PDF转图片
convert -density 400 input.pdf picture.png
Here, -density 400 specifies the horizontal resolution of the output image file(s).
The above command will convert all pages in the given PDF file to PNG format. Each page in the PDF file will be converted into a PNG file and they will be saved in the current directory with file name picture-1.png, picture-2.png ... and so on. Please be patient. It will take a while depending on the number of pages in the input PDF file.
Once all pages in the PDF converted into PNG format, run the following command to create a video file from the PNG files.
-
图片转视频
fmpeg -r 1/10 -i picture-%01d.png -c:v libx264 -r 30 -pix_fmt yuv420p video.mp4
Here,
-r 1/10 : Display each image for 10 seconds.
-i picture-%01d.png : Reads all pictures that starts with name "picture-", following with 1 digit (%01d) and ending with .png. If the images name comes with 2 digits (I.e picture-10.png, picture11.png etc), use (%02d) in the above command.
-c:v libx264 : Output video codec (i.e h264).
-r 30 : framerate of output video
-pix_fmt yuv420p : Output video resolution
video.mp4 : Output video file with .mp4 format.
After the video is created, you can watch it from any devices that supports .mp4 format. After the video is created, you can watch it from any devices that supports .mp4 format. Next, I need to find a way to insert a cool music to my video. I hope it won't be difficult either.If you wanted it in higher pixel resolution, you don't have to start all over again. Just convert the output video file to any other higher/lower resolution of your choice, say 720p, as shown below.
-
视频加入音乐
ffmpeg -i video.mp4 -vf scale=-1:720 video_720p.mp4
-
PDF转图片
-
视频转mp3
ffmpeg -i .\a.flv -vn b.mp3