Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th August 2014, 09:54   #1  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,453
Lossless with "-QP 0"?

Speaking of lossless, how lossless is encoding with "-QP 0" (x264) really?

I have a project that requires several passes, with lossless intermediate steps. Will "-QP 0" do it?

Thanks.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 28th August 2014, 09:57   #2  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,239
--qp 0 is entirely lossless, if you also ensure it uses the same pixel format (ie. chroma is not being resampled, or anything like that)
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 28th August 2014, 09:58   #3  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,453
Quote:
Originally Posted by nevcairiel View Post
--qp 0 is entirely lossless, if you also ensure it uses the same pixel format (ie. chroma is not being resampled, or anything like that)
Thanks. Question answered.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 5th September 2014, 02:43   #4  |  Link
F J Walter
Registered User
 
Join Date: Oct 2007
Posts: 47
Does setting --qp 0 also set other options to sensible values for lossless coding?

For example, does it disable AQ and psy options?

Or should I be doing that myself?
F J Walter is offline   Reply With Quote
Old 5th September 2014, 02:58   #5  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,230
Quote:
Originally Posted by F J Walter View Post
Does setting --qp 0 also set other options to sensible values for lossless coding?
Yes, it does.

Quote:
Originally Posted by F J Walter View Post
For example, does it disable AQ and psy options?
Those don't apply to lossless encoding, for obvious reasons.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 10th September 2014, 02:44   #6  |  Link
F J Walter
Registered User
 
Join Date: Oct 2007
Posts: 47
Quote:
Originally Posted by LoRd_MuldeR View Post
Those don't apply to lossless encoding, for obvious reasons.
A quick test shows this is correct: --psy-rd and --aq-mode have no effect on the output in lossless.

The same goes for --trellis, and --deadzone-intra - I guess lossless uses a different quantization algorithm to both trellis and deadzone (either that or it locks off these parameters).

Options like --subme and --me do change the output size though, so these are not locked off in lossless. And --subme 7 results in a lower file size than --subme 5 implying that normal non-psy RDO is still active in lossless.

In lossless there is not very much different in output size as long as you don't go below --preset fast (eg, medium, slow, slower don't offer much benefit). And lossless is significantly slower than non-lossless even with all else equal, eg lossless with --preset fast is much slower than --preset fast is normally.

I could have done this testing myself instead of asking you, sorry!

Last edited by F J Walter; 10th September 2014 at 02:48.
F J Walter is offline   Reply With Quote
Old 10th September 2014, 04:28   #7  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,565
Any options that trade-off different artifacts (like AQ & psy prefer more noise instead of more blur, trellis and deadzone also affect the blur vs noise) don't matter when there's no blur or noise. I'm pretty sure they're ignored in lossless, but the result would be the same if they weren't.
foxyshadis is offline   Reply With Quote
Old 10th September 2014, 15:17   #8  |  Link
fionag
x264 author
 
Join Date: Jul 2014
Posts: 6
From encoder.c:

Code:
if( b_open && (h->param.rc.i_rc_method == X264_RC_CQP || h->param.rc.i_rc_method == X264_RC_CRF)
        && h->param.rc.i_qp_constant == 0 )
    {
        h->mb.b_lossless = 1;
        h->param.i_cqm_preset = X264_CQM_FLAT;
        h->param.psz_cqm_file = NULL;
        h->param.rc.i_rc_method = X264_RC_CQP;
        h->param.rc.f_ip_factor = 1;
        h->param.rc.f_pb_factor = 1;
        h->param.analyse.b_psnr = 0;
        h->param.analyse.b_ssim = 0;
        h->param.analyse.i_chroma_qp_offset = 0;
        h->param.analyse.i_trellis = 0;
        h->param.analyse.b_fast_pskip = 0;
        h->param.analyse.i_noise_reduction = 0;
        h->param.analyse.b_psy = 0;
        h->param.i_bframe = 0;
        /* 8x8dct is not useful without RD in CAVLC lossless */
        if( !h->param.b_cabac && h->param.analyse.i_subpel_refine < 6 )
            h->param.analyse.b_transform_8x8 = 0;
        h->param.analyse.inter &= ~X264_ANALYSE_I8x8;
        h->param.analyse.intra &= ~X264_ANALYSE_I8x8;
    }
fionag is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.