Posts: 9
Threads: 3
Joined: Dec 2021
Would it be possible for you to include JPG exporting with the adequate quality options as an alternative to PNG exporting?
PNG files are often bloated in size and slower to encode, JPG encoding could bring significant speed boosts to my entire workflow and it would be very helpful.
I'm very willing to test if the feature is implemented
Thanks in advance!
Posts: 10.548
Threads: 57
Joined: May 2017
13.12.2021, 18:14
(This post was last modified: 13.12.2021, 18:15 by Selur.)
Got any documentation regarding how to use ffmpeg for jpeg creation?
Using
ffmpeg -h encoder=libopenjpg
I get
Encoder libopenjpeg [OpenJPEG JPEG 2000]:
General capabilities: threads
Threading capabilities: frame
Supported pixel formats: rgb24 rgba rgb48le rgba64le gbrp gbrp9le gbrp10le gbrp12le gbrp14le gbrp16le gray ya8 gray16le ya16le gray10le gray12le gray14le yuv420p yuv422p yuva420p yuv440p yuv444p yuva422p yuv411p yuv410p yuva444p yuv420p9le yuv422p9le yuv444p9le yuva420p9le yuva422p9le yuva444p9le yuv420p10le yuv422p10le yuv444p10le yuva420p10le yuva422p10le yuva444p10le yuv420p12le yuv422p12le yuv444p12le yuv420p14le yuv422p14le yuv444p14le yuv420p16le yuv422p16le yuv444p16le yuva420p16le yuva422p16le yuva444p16le xyz12le
libopenjpeg AVOptions:
-format <int> E..V....... Codec Format (from 0 to 2) (default jp2)
j2k 0 E..V.......
jp2 2 E..V.......
-profile <int> E..V....... (from 0 to 4) (default jpeg2000)
jpeg2000 0 E..V.......
cinema2k 3 E..V.......
cinema4k 4 E..V.......
-cinema_mode <int> E..V....... Digital Cinema (from 0 to 3) (default off)
off 0 E..V.......
2k_24 1 E..V.......
2k_48 2 E..V.......
4k_24 3 E..V.......
-prog_order <int> E..V....... Progression Order (from 0 to 4) (default lrcp)
lrcp 0 E..V.......
rlcp 1 E..V.......
rpcl 2 E..V.......
pcrl 3 E..V.......
cprl 4 E..V.......
-numresolution <int> E..V....... (from 0 to 33) (default 6)
-irreversible <int> E..V....... (from 0 to 1) (default 0)
-disto_alloc <int> E..V....... (from 0 to 1) (default 1)
-fixed_quality <int> E..V....... (from 0 to 1) (default 0)
using:
ffmpeg -h encoder=jpeg2000
I get:
Encoder jpeg2000 [JPEG 2000]:
General capabilities: none
Threading capabilities: none
Supported pixel formats: rgb24 yuv444p gray yuv420p yuv422p yuv410p yuv411p pal8 rgb48le gray16le
jpeg 2000 encoder AVOptions:
-format <int> E..V....... Codec Format (from 0 to 1) (default jp2)
j2k 0 E..V.......
jp2 1 E..V.......
-tile_width <int> E..V....... Tile Width (from 1 to 1.07374e+09) (default 256)
-tile_height <int> E..V....... Tile Height (from 1 to 1.07374e+09) (default 256)
-pred <int> E..V....... DWT Type (from 0 to 1) (default dwt97int)
dwt97int 0 E..V.......
dwt53 0 E..V.......
-sop <int> E..V....... SOP marker (from 0 to 1) (default 0)
-eph <int> E..V....... EPH marker (from 0 to 1) (default 0)
-prog <int> E..V....... Progression Order (from 0 to 4) (default lrcp)
lrcp 0 E..V.......
rlcp 1 E..V.......
rpcl 2 E..V.......
pcrl 3 E..V.......
cprl 4 E..V.......
-layer_rates <string> E..V....... Layer Rates
There's also jpegls, ljpeg, mjpeg.
Problem is I see no documentation what the options really do. (Last time I read up on jpeg compression was 20+ years ago,...)
Also are you use writing the pngs is the bottleneck on your processing in Hybrid ? (usually it's the filtering or decoding, when it's not the encoder)
Quote:JPG encoding could bring significant speed boosts to my entire workflow and it would be very helpful.
Out of curiousity: What is your workflow that using lossy jpeg compression it worth it?
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 9
Threads: 3
Joined: Dec 2021
From what I gathered with other GUIs and people, mjpeg should be the encoder used in ffmpeg to output Jpeg files.
I'm not sure though as I'm not particularly familiar with ffmpeg.
My workflow currently consists of upscaling and interpolating, both of which suffer very minimal quality loss even if I'm using jpeg instead of png. Moreover, using jpegs would probably save my SSDs from torture since I could shed a few hundred gigs per job.
(13.12.2021, 18:14)Selur Wrote: Got any documentation regarding how to use ffmpeg for jpeg creation?
Using
ffmpeg -h encoder=libopenjpg
I get
Encoder libopenjpeg [OpenJPEG JPEG 2000]:
General capabilities: threads
Threading capabilities: frame
Supported pixel formats: rgb24 rgba rgb48le rgba64le gbrp gbrp9le gbrp10le gbrp12le gbrp14le gbrp16le gray ya8 gray16le ya16le gray10le gray12le gray14le yuv420p yuv422p yuva420p yuv440p yuv444p yuva422p yuv411p yuv410p yuva444p yuv420p9le yuv422p9le yuv444p9le yuva420p9le yuva422p9le yuva444p9le yuv420p10le yuv422p10le yuv444p10le yuva420p10le yuva422p10le yuva444p10le yuv420p12le yuv422p12le yuv444p12le yuv420p14le yuv422p14le yuv444p14le yuv420p16le yuv422p16le yuv444p16le yuva420p16le yuva422p16le yuva444p16le xyz12le
libopenjpeg AVOptions:
-format <int> E..V....... Codec Format (from 0 to 2) (default jp2)
j2k 0 E..V.......
jp2 2 E..V.......
-profile <int> E..V....... (from 0 to 4) (default jpeg2000)
jpeg2000 0 E..V.......
cinema2k 3 E..V.......
cinema4k 4 E..V.......
-cinema_mode <int> E..V....... Digital Cinema (from 0 to 3) (default off)
off 0 E..V.......
2k_24 1 E..V.......
2k_48 2 E..V.......
4k_24 3 E..V.......
-prog_order <int> E..V....... Progression Order (from 0 to 4) (default lrcp)
lrcp 0 E..V.......
rlcp 1 E..V.......
rpcl 2 E..V.......
pcrl 3 E..V.......
cprl 4 E..V.......
-numresolution <int> E..V....... (from 0 to 33) (default 6)
-irreversible <int> E..V....... (from 0 to 1) (default 0)
-disto_alloc <int> E..V....... (from 0 to 1) (default 1)
-fixed_quality <int> E..V....... (from 0 to 1) (default 0)
using:
ffmpeg -h encoder=jpeg2000
I get:
Encoder jpeg2000 [JPEG 2000]:
General capabilities: none
Threading capabilities: none
Supported pixel formats: rgb24 yuv444p gray yuv420p yuv422p yuv410p yuv411p pal8 rgb48le gray16le
jpeg 2000 encoder AVOptions:
-format <int> E..V....... Codec Format (from 0 to 1) (default jp2)
j2k 0 E..V.......
jp2 1 E..V.......
-tile_width <int> E..V....... Tile Width (from 1 to 1.07374e+09) (default 256)
-tile_height <int> E..V....... Tile Height (from 1 to 1.07374e+09) (default 256)
-pred <int> E..V....... DWT Type (from 0 to 1) (default dwt97int)
dwt97int 0 E..V.......
dwt53 0 E..V.......
-sop <int> E..V....... SOP marker (from 0 to 1) (default 0)
-eph <int> E..V....... EPH marker (from 0 to 1) (default 0)
-prog <int> E..V....... Progression Order (from 0 to 4) (default lrcp)
lrcp 0 E..V.......
rlcp 1 E..V.......
rpcl 2 E..V.......
pcrl 3 E..V.......
cprl 4 E..V.......
-layer_rates <string> E..V....... Layer Rates
There's also jpegls, ljpeg, mjpeg.
Problem is I see no documentation what the options really do. (Last time I read up on jpeg compression was 20+ years ago,...)
Also are you use writing the pngs is the bottleneck on your processing in Hybrid ? (usually it's the filtering or decoding, when it's not the encoder)
Quote:JPG encoding could bring significant speed boosts to my entire workflow and it would be very helpful.
Out of curiousity: What is your workflow that using lossy jpeg compression it worth it?
Cu Selur
Ffmpeg -i "source" "output folder/%6d.jpg"
This was one of the commands my friends that had more expertise gave me, maybe you could test it out?
Thanks!
Posts: 10.548
Threads: 57
Joined: May 2017
Encoder mjpeg [MJPEG (Motion JPEG)]:
General capabilities: threads
Threading capabilities: frame and slice
Supported pixel formats: yuvj420p yuvj422p yuvj444p yuv420p yuv422p yuv444p
mjpeg encoder AVOptions:
-mpv_flags <flags> E..V....... Flags common for all mpegvideo-based encoders. (default 0)
skip_rd E..V....... RD optimal MB level residual skipping
strict_gop E..V....... Strictly enforce gop size
qp_rd E..V....... Use rate distortion optimization for qp selection
cbp_rd E..V....... use rate distortion optimization for CBP
naq E..V....... normalize adaptive quantization
mv0 E..V....... always try a mb with mv=<0,0>
-luma_elim_threshold <int> E..V....... single coefficient elimination threshold for luminance (negative values also consider dc coefficient) (from INT_MIN to INT_MAX) (default 0)
-chroma_elim_threshold <int> E..V....... single coefficient elimination threshold for chrominance (negative values also consider dc coefficient) (from INT_MIN to INT_MAX) (default 0)
-quantizer_noise_shaping <int> E..V....... (from 0 to INT_MAX) (default 0)
-error_rate <int> E..V....... Simulate errors in the bitstream to test error concealment. (from 0 to INT_MAX) (default 0)
-qsquish <float> E..V....... how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function) (from 0 to 99) (default 0)
-rc_qmod_amp <float> E..V....... experimental quantizer modulation (from -FLT_MAX to FLT_MAX) (default 0)
-rc_qmod_freq <int> E..V....... experimental quantizer modulation (from INT_MIN to INT_MAX) (default 0)
-rc_eq <string> E..V....... Set rate control equation. When computing the expression, besides the standard functions defined in the section 'Expression Evaluation', the following functions are available: bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.
-rc_init_cplx <float> E..V....... initial complexity for 1-pass encoding (from -FLT_MAX to FLT_MAX) (default 0)
-rc_buf_aggressivity <float> E..V....... currently useless (from -FLT_MAX to FLT_MAX) (default 1)
-border_mask <float> E..V....... increase the quantizer for macroblocks close to borders (from -FLT_MAX to FLT_MAX) (default 0)
-lmin <int> E..V....... minimum Lagrange factor (VBR) (from 0 to INT_MAX) (default 236)
-lmax <int> E..V....... maximum Lagrange factor (VBR) (from 0 to INT_MAX) (default 3658)
-ibias <int> E..V....... intra quant bias (from INT_MIN to INT_MAX) (default 999999)
-pbias <int> E..V....... inter quant bias (from INT_MIN to INT_MAX) (default 999999)
-motion_est <int> E..V....... motion estimation algorithm (from 0 to 2) (default epzs)
zero 0 E..V.......
epzs 1 E..V.......
xone 2 E..V.......
-skip_threshold <int> E..V....... Frame skip threshold (from INT_MIN to INT_MAX) (default 0)
-skip_factor <int> E..V....... Frame skip factor (from INT_MIN to INT_MAX) (default 0)
-skip_exp <int> E..V....... Frame skip exponent (from INT_MIN to INT_MAX) (default 0)
-skip_cmp <int> E..V....... Frame skip compare function (from INT_MIN to INT_MAX) (default dctmax)
sad 0 E..V....... Sum of absolute differences, fast
sse 1 E..V....... Sum of squared errors
satd 2 E..V....... Sum of absolute Hadamard transformed differences
dct 3 E..V....... Sum of absolute DCT transformed differences
psnr 4 E..V....... Sum of squared quantization errors, low quality
bit 5 E..V....... Number of bits needed for the block
rd 6 E..V....... Rate distortion optimal, slow
zero 7 E..V....... Zero
vsad 8 E..V....... Sum of absolute vertical differences
vsse 9 E..V....... Sum of squared vertical differences
nsse 10 E..V....... Noise preserving sum of squared differences
dct264 14 E..V.......
dctmax 13 E..V.......
chroma 256 E..V.......
msad 15 E..V....... Sum of absolute differences, median predicted
-sc_threshold <int> E..V....... Scene change threshold (from INT_MIN to INT_MAX) (default 0)
-noise_reduction <int> E..V....... Noise reduction (from INT_MIN to INT_MAX) (default 0)
-ps <int> E..V....... RTP payload size in bytes (from INT_MIN to INT_MAX) (default 0)
-mepc <int> E..V....... Motion estimation bitrate penalty compensation (1.0 = 256) (from INT_MIN to INT_MAX) (default 256)
-mepre <int> E..V....... pre motion estimation (from INT_MIN to INT_MAX) (default 0)
-intra_penalty <int> E..V....... Penalty for intra blocks in block decision (from 0 to 1.07374e+09) (default 0)
-pred <int> E..V....... Prediction method (from 1 to 3) (default left)
left 1 E..V.......
plane 2 E..V.......
median 3 E..V.......
-huffman <int> E..V....... Huffman table strategy (from 0 to 1) (default optimal)
default 0 E..V.......
optimal 1 E..V.......
-force_duplicated_matrix <boolean> E..V....... Always write luma and chroma matrix for mjpeg, useful for rtp streaming. (default false)
-mpeg_quant <int> E..V......P Deprecated, does nothing (from 0 to 0) (default 0)
-a53cc <boolean> E..V......P Deprecated, does nothing (default true)
-b_strategy <int> E..V......P Deprecated, does nothing (from 0 to 2) (default 0)
-b_sensitivity <int> E..V......P Deprecated, does nothing (from 1 to INT_MAX) (default 40)
-brd_scale <int> E..V......P Deprecated, does nothing (from 0 to 3) (default 0)
mjpeg = motion jpeg
This usually means the jpegs are written into a container like .avi/.mov/...
I don't see any 'quality'-control. May be '-q:v X' works,...
I will think about it, if someone can find some decent documentation.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 9
Threads: 3
Joined: Dec 2021
(13.12.2021, 18:34)Selur Wrote: Encoder mjpeg [MJPEG (Motion JPEG)]:
General capabilities: threads
Threading capabilities: frame and slice
Supported pixel formats: yuvj420p yuvj422p yuvj444p yuv420p yuv422p yuv444p
mjpeg encoder AVOptions:
-mpv_flags <flags> E..V....... Flags common for all mpegvideo-based encoders. (default 0)
skip_rd E..V....... RD optimal MB level residual skipping
strict_gop E..V....... Strictly enforce gop size
qp_rd E..V....... Use rate distortion optimization for qp selection
cbp_rd E..V....... use rate distortion optimization for CBP
naq E..V....... normalize adaptive quantization
mv0 E..V....... always try a mb with mv=<0,0>
-luma_elim_threshold <int> E..V....... single coefficient elimination threshold for luminance (negative values also consider dc coefficient) (from INT_MIN to INT_MAX) (default 0)
-chroma_elim_threshold <int> E..V....... single coefficient elimination threshold for chrominance (negative values also consider dc coefficient) (from INT_MIN to INT_MAX) (default 0)
-quantizer_noise_shaping <int> E..V....... (from 0 to INT_MAX) (default 0)
-error_rate <int> E..V....... Simulate errors in the bitstream to test error concealment. (from 0 to INT_MAX) (default 0)
-qsquish <float> E..V....... how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function) (from 0 to 99) (default 0)
-rc_qmod_amp <float> E..V....... experimental quantizer modulation (from -FLT_MAX to FLT_MAX) (default 0)
-rc_qmod_freq <int> E..V....... experimental quantizer modulation (from INT_MIN to INT_MAX) (default 0)
-rc_eq <string> E..V....... Set rate control equation. When computing the expression, besides the standard functions defined in the section 'Expression Evaluation', the following functions are available: bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.
-rc_init_cplx <float> E..V....... initial complexity for 1-pass encoding (from -FLT_MAX to FLT_MAX) (default 0)
-rc_buf_aggressivity <float> E..V....... currently useless (from -FLT_MAX to FLT_MAX) (default 1)
-border_mask <float> E..V....... increase the quantizer for macroblocks close to borders (from -FLT_MAX to FLT_MAX) (default 0)
-lmin <int> E..V....... minimum Lagrange factor (VBR) (from 0 to INT_MAX) (default 236)
-lmax <int> E..V....... maximum Lagrange factor (VBR) (from 0 to INT_MAX) (default 3658)
-ibias <int> E..V....... intra quant bias (from INT_MIN to INT_MAX) (default 999999)
-pbias <int> E..V....... inter quant bias (from INT_MIN to INT_MAX) (default 999999)
-motion_est <int> E..V....... motion estimation algorithm (from 0 to 2) (default epzs)
zero 0 E..V.......
epzs 1 E..V.......
xone 2 E..V.......
-skip_threshold <int> E..V....... Frame skip threshold (from INT_MIN to INT_MAX) (default 0)
-skip_factor <int> E..V....... Frame skip factor (from INT_MIN to INT_MAX) (default 0)
-skip_exp <int> E..V....... Frame skip exponent (from INT_MIN to INT_MAX) (default 0)
-skip_cmp <int> E..V....... Frame skip compare function (from INT_MIN to INT_MAX) (default dctmax)
sad 0 E..V....... Sum of absolute differences, fast
sse 1 E..V....... Sum of squared errors
satd 2 E..V....... Sum of absolute Hadamard transformed differences
dct 3 E..V....... Sum of absolute DCT transformed differences
psnr 4 E..V....... Sum of squared quantization errors, low quality
bit 5 E..V....... Number of bits needed for the block
rd 6 E..V....... Rate distortion optimal, slow
zero 7 E..V....... Zero
vsad 8 E..V....... Sum of absolute vertical differences
vsse 9 E..V....... Sum of squared vertical differences
nsse 10 E..V....... Noise preserving sum of squared differences
dct264 14 E..V.......
dctmax 13 E..V.......
chroma 256 E..V.......
msad 15 E..V....... Sum of absolute differences, median predicted
-sc_threshold <int> E..V....... Scene change threshold (from INT_MIN to INT_MAX) (default 0)
-noise_reduction <int> E..V....... Noise reduction (from INT_MIN to INT_MAX) (default 0)
-ps <int> E..V....... RTP payload size in bytes (from INT_MIN to INT_MAX) (default 0)
-mepc <int> E..V....... Motion estimation bitrate penalty compensation (1.0 = 256) (from INT_MIN to INT_MAX) (default 256)
-mepre <int> E..V....... pre motion estimation (from INT_MIN to INT_MAX) (default 0)
-intra_penalty <int> E..V....... Penalty for intra blocks in block decision (from 0 to 1.07374e+09) (default 0)
-pred <int> E..V....... Prediction method (from 1 to 3) (default left)
left 1 E..V.......
plane 2 E..V.......
median 3 E..V.......
-huffman <int> E..V....... Huffman table strategy (from 0 to 1) (default optimal)
default 0 E..V.......
optimal 1 E..V.......
-force_duplicated_matrix <boolean> E..V....... Always write luma and chroma matrix for mjpeg, useful for rtp streaming. (default false)
-mpeg_quant <int> E..V......P Deprecated, does nothing (from 0 to 0) (default 0)
-a53cc <boolean> E..V......P Deprecated, does nothing (default true)
-b_strategy <int> E..V......P Deprecated, does nothing (from 0 to 2) (default 0)
-b_sensitivity <int> E..V......P Deprecated, does nothing (from 1 to INT_MAX) (default 40)
-brd_scale <int> E..V......P Deprecated, does nothing (from 0 to 3) (default 0)
mjpeg = motion jpeg
This usually means the jpegs are written into a container like .avi/.mov/...
I don't see any 'quality'-control. May be '-q:v X' works,...
I will think about it, if someone can find some decent documentation.
Cu Selur Would it be possible for you to implement mozjpeg instead as a seperate encoder?
And also as to the mjpeg part, q:v is indeed the intended quality control for it, as for the output extension, not specifying the encoder and instead just using it to export .jpg seems to work
Posts: 10.548
Threads: 57
Joined: May 2017
Quote:Would it be possible for you to implement mozjpeg instead as a seperate encoder?
Assuming it has a command line interface which accepts input via pipe, I would need:
a. documentation about it
b. a way to build it for MacOS and Linux too
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 9
Threads: 3
Joined: Dec 2021
(14.12.2021, 05:09)Selur Wrote: Quote:Would it be possible for you to implement mozjpeg instead as a seperate encoder?
Assuming it has a command line interface which accepts input via pipe, I would need:
a. documentation about it
b. a way to build it for MacOS and Linux too
Cu Selur
So implementing jpeg encoding seems rather improbable right?
does exporting as .jpg not work? Afaik that's how most people do it
|