当前位置:网站首页>Ffmpeg --- image processing
Ffmpeg --- image processing
2022-07-07 14:48:00 【mytzs123】
explain : In the following test command image_source Is the input file to be processed ,out_source It is the output file after processing
1. Picture compression :ffmpeg It can perfectly compress pictures to generate new pictures , And you can set the compression level
ffmpeg -i image_source -q compress_level out_source
#compress_level: The compression level is a positive integer , The higher the value, the higher the compression level 2. Constrain proportional compression
ffmpeg You can compress the picture to a specified size
ffmpeg -i image_source -vf scale=width:height out_source
#width Is the width of the compressed picture
#height Is the height of the compressed picture
# When width or height One of the values is -1 It will keep the original image size ratio compressed 3. Image clipping
ffmpeg You can specify the cropping position and size of the image
ffmpeg -i image_source -vf crop=width:height:from_x:from_y out_source
#width Is the width of the image to be cropped
#height Is the height of the image to be cropped
#from_x It is the beginning of cutting X Position of the shaft
#from_y It is the beginning of cutting Y Position of the shaft
# If you don't specify from_x and from_y Means to crop from the center of the original picture 4. Add watermark image
ffmpeg You can add watermarks to pictures , You can set the size of the watermark image 、 Location and transparency
ffmpeg -i image_source -vf movie=logo_source,scale=logo_width:logo_height,lut=a=val*opacity_num[watermask];[in][watermask] overlay=from_x:from_y[out] -y out_source
#logo_source Is the watermark image address
#logo_width Is the width of the watermark image
#logo_height Is the height of the watermark image
#opacity_num For the transparency of watermark image
#from_x Is the beginning of the watermark X Position of the shaft
#from_y Is the beginning of the watermark Y Position of the shaft 5. Add text watermark
ffmpeg You can add text watermarks to pictures , You can set the font 、 Color 、 Size 、 Written content 、 Text location
ffmpeg -i image_source -vf drawtext=fontfile=font_ttf_path:fontcolor=font_color:fontsize=font_size:text=message_info:x=from_x:y=from_y out_source
#font_ttf_path Is the font path , This item must be set, otherwise there will be an error that the font cannot be found ;
# Set the absolute path for the font path and pay attention to the escape of the positive and negative slashes of the path ( for example C\\:/Windows/Fonts/simhei.ttf)
#font_color For the color of the font
#font_size Is the size of the font
#message_info Watermark text content
#from_x Is the beginning of the watermark X Position of the shaft
#from_y Is the beginning of the watermark Y Position of the shaft
# If the watermark content is Chinese, you need to set the Chinese font, otherwise the text will display garbled 6. Rotate the picture by the specified angle
ffmpeg You can rotate the picture according to the specified angle to generate a new picture
ffmpeg -i image_source -vf rotate=route_num*PI/180 -y out_source
#route_num Is the angle to rotate
# When route_num Greater than 0 Rotate clockwise when , When route_num Less than 0 Rotate counterclockwise when
7. Image rotation special simple command
The above command can theoretically complete all image rotation operations , but ffmpeg There is still a special simple rotating life
ffmpeg -i image_source -vf transpose=route_number -y out_source
#route_number=0 Clockwise rotation 90 Degrees mirror left and right again
#route_number=1 Clockwise rotation 90 degree
#route_number=2 Counter clockwise rotation 90 degree
#route_number=3 Counter clockwise rotation 90 Degrees mirror left and right again
8. The picture is mirrored left and right
ffmpeg -i image_source -vf hflip out_source
9. Mirror the picture up and down
ffmpeg -i image_source -vf vflip out_source边栏推荐
- LeetCode 648. Word replacement
- 一文读懂数仓中的pg_stat
- Demis Hassabis谈AlphaFold未来目标
- Electronic remote error
- leetcode:648. Word replacement [dictionary tree board + find the shortest matching prefix among several prefixes]
- 数据库如何进行动态自定义排序?
- JS get the current time, month, day, year, and the uniapp location applet opens the map to select the location
- STM32CubeMX,68套组件,遵循10条开源协议
- [today in history] July 7: release of C; Chrome OS came out; "Legend of swordsman" issued
- Find your own value
猜你喜欢
随机推荐
OAuth 2.0 + JWT 保护API安全
In the field of software engineering, we have been doing scientific research for ten years!
2022PAGC 金帆奖 | 融云荣膺「年度杰出产品技术服务商」
拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条...
Shengteng experience officer Episode 5 notes I
electron remote 报错
解析PHP跳出循环的方法以及continue、break、exit的区别介绍
Source code analysis of ArrayList
半小时『直播连麦搭建』动手实战,大学生技术岗位简历加分项get!
ES日志报错赏析-trying to create too many buckets
How bad can a programmer be? Nima, they are all talents
智汀不用Home Assistant让小米智能家居接入HomeKit
一文读懂数仓中的pg_stat
Es log error appreciation -- allow delete
Oracle Linux 9.0 正式发布
Introduction and use of Kitti dataset
word中删除一整页
A laravel background management expansion package you can't miss - Voyager
缓冲区溢出保护
AWS learning notes (III)








