Sideway
output.to from Sideway
Draft for Information Only

Content

FFmpeg Function
 Image-Image Functions
  Image Compression
   Switch: -compression_level
    Syntax
    Arguments
    Remarks
    Code Examples
   Switch: -qscale or -q
    Syntax
    Arguments
    Remarks
    Code Examples
 Source and Reference

FFmpeg Function

FFmpeg is a command line tool with a set of libraries in many dfferent formats for manipulating or prcessing multimedia data through encoding and decoding. The available FFmgeg functios only depend on the command line instruction.30Dec2019

Image-Image Functions

Image to image manipulation is one kind of simple functions available in FFmpeg

Image Compression

Digital picture data can be stored in a image file of different format. Each image format uses different kind of algorithm to pack the picture data in one single file. FFmmpeg image compression is the process used to further optimize the balance between image quality and file size according to the specifed requirement. The two types of methods used to compress a image are lossless and lossy compressions. Lossless image compression has no loss in quality but usually bigger file sizes. Lossy image compression has a loss in quality but usually smaller file sizes. Every file format has its own compression method. e.g. PNG format is an example of lossless compression, JPEG/JPG format is an example of lossy compression.
The optimization of image compression in FFmpeg can be controlled by specifying the corresponding switches accordingly. The switches used for image compression are -compression_level, -q:v etc. But for general purpose usage, image compression can be done by entering the input and output directly to FFmpeg and FFmpeg will automatically select the right decoder and encoder with the corresponding default value to process and optimize the input into the output. ffmpeg -i input output

Switch: -compression_level

to specify the level of compression required for the output with respect to the input.
Syntax
-compression_level integer
Arguments
integerValue ranges vary between encoders.
Remarks
For lossy, compression_level is a quality/speed trade off. Higher values give better quality for a given size at the cost of increased encoding time. For lossless, compression_level is a size/speed tradeoff. Higher values give smaller size at the cost of increased encoding time. More specifically, compression_level controls the number of extra algorithms and compression tools used, and varies the combination of these tools. But, the compressed ratio between the output and input only depends on the result of extra algorithms and compression tools used.
For WebP, value maps to the method option in libwebp. The valid range is 0 to 6. Default compression_level value is 4.
For PNG, the image format itself is supposed to be a lossless format. Compressed image quality is not dependent on compression ratio. The valid range of compression level is 0-100. Default compression_level value is 100 with highest output compression.
For JPEG/JPG, the compressed image quality is highly affected by compression ratio. The image quality controlled by -qscale has higher priority over level of compression controlled by -compression_level, and the default or specified -qscale/-q value will dominate the compression process. Default -qscale/-q value for JPEG/JPG is 6
Code Examples
Compress PNG Image
Example to compress a png image..
ffmpeg -hide_banner -i in\dt16001024.png -compression_level 100 out\cmplvl100.png
Command result image
Compress JPG/JPEG Image
Example to compress a jpg/jpeg image is
ffmpeg -hide_banner -i in\dt16001024.jpg -compression_level 100 out\cmplvl100.jpg
Command result image

Switch: -qscale or -q

to specify the fixed quality scale (VBR) required for the output.
Syntax
-q[:stream_specifier] float
-qscale[:stream_specifier] float
Arguments
:Separator stream_specifierOptional. If qscale is used without a stream_specifier then qscale applies only to the video stream.vto specify a video streamato specify an audio streamsto specify a subtitle stream floatValue ranges vary between encoders.
Remarks
Similarly, for lossy encoding, -qscale controls image quality, and for lossless encoding, -qscale controls the effort and time spent at compressing more.
For WebP, -qscale controls image quality on lossy encoding. The valid range is 0 to 100. Default value is 75.
Note that for usage via libavcodec, this option is called global_quality and must be multiplied by FF_QP2LAMBDA.
For JPEG/JPG, -qscale controls image quality. The valid range is 2 to 31. Lower value is higher quality value. Value 0 means lossless encoding. Value 1 is not recommended because of much larger file, little quality difference, and may causing problems on decoding and encoding. Default -qscale value is 6.
For PNG, the image format itself is supposed to be a lossless format. The level of compression controlled by -compression_level has higher priority over the image quality controlled by -qscale. The default or specified -compression_level value will dominate the compression process.
Code Examples
Compress PNG Image
Example to compress a png image..
ffmpeg -hide_banner -i in\dt16001024.png -qscale:v 6 out\qscale6.png
Command result image
Compress JPG/JPEG Image
Example to compress a jpg/jpeg image is
ffmpeg -hide_banner -i in\dt16001024.jpg -qscale:v 6 out\qscale6.jpg
Command result image

Source and Reference

https://ffmpeg.org/ffmpeg.html
https://ffmpeg.org/ffmpeg-all.html
https://www.howtogeek.com/203979/is-the-png-format-lossless-since-it-has-a-compression-parameter/

©sideway

ID: 200101402 Last Updated: 14/1/2020 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 7

Culture

Chinese 1097

English 337

Reference 67

Computer

Hardware 149

Software

Application 196

Digitization 30

Numeric 19

Programming

Web 648

HTML 65

CSS 58

ASP.NET 62

OS 389

DeskTop 7

Knowledge

Mathematics

Formulas 8

Algebra 24

Number Theory 206

Trigonometry 18

Geometry 18

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Physics

Electric 27

Biology 1

Geography 1


Copyright © 2000-2020 Sideway . All rights reserved Disclaimers last modified on 06 September 2019