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 16th April 2024, 07:21   #61  |  Link
Tlen
Registered User
 
Join Date: Apr 2020
Posts: 23
Quote:
Originally Posted by benwaggoner View Post
IDR-only HEVC lossless is more efficient than anything you’ve listed, and has HW decode support.
I don't doubt it will be probably more efficient in terms of pure compression ratio.

But much probably it will be even slower than x264, so at present day
pheraps it's not an option, cause of the cpu / time cost,
unless the compression gain is so huge that can balance the cost.

Out of curiosity, command line for x265 lossless?
Tlen is offline   Reply With Quote
Old 16th April 2024, 14:33   #62  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 332
Quote:
Originally Posted by Tlen View Post
I remember that huffyuv was way beyond compression ratio than lagarith although very much faster,
but for archival needs, compression ratio has more weight in the equation.

I remember testing FFV1 long time ago and not remembering why i discarded ahaha
Same as MagicYUV which i tested but didn't choose.

Next time pheraps I'll re-evaluate MagicYUV which I vaguely remember had good ratio and high speed.

Concerning high bit depth, yes atm I don't deal with that so it's out of the requirements.
Just FYI it can be worth testing x264 in a faster preset, in my experience there isnt a drastic difference in filesize/compression in lossless mode between the presets.

Did a tests a few years back comparring a few lossless codecs (only tested codecs bundled with ffmpeg):

Quote:
Originally Posted by excellentswordfight View Post
Did a quick test a year or two ago with a 1min sample from an 1080p24 bluray:

Original: 179 MiB
x264 (preset veryslow, crf 0): 733 MiB
x264 (preset fast, crf 0): 765 MiB
x265 (preset veryslow, lossless): 808 MiB
FFV1: 831 MiB
JPEG2000: 932 MiB
x265 (preset fast, lossless): 934 MiB
Ut Video: 1.30 GiB
HUFFYUV: 1.87 GiB
Uncompressed: 4.17GiB
Not sure if x265 lossless mode is "fixed", but when I tried it, it was worse than x264.
excellentswordfight is offline   Reply With Quote
Old 16th April 2024, 16:55   #63  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,412
Quote:
Originally Posted by Tlen View Post
Just for the records,
because i had to make a lossless compression of a 4 hours film
I always used Lagarith as default,
so i tried x264 lossless to see what happens.

4 Hour, 1920 * 1080 YV12

x264 (qp 0 very slow)
210 GB @ 13.4 fps
Decoding speed ok (no frame lost) on a Low TDP CPU (i5) but CPU stuck at 100%

Lagarith
264 GB @ 120 fps
Decoding speed ok (no frame lost) on a Low TDP CPU (i5) - CPU 88%

Ssso I think that the only pro of x264 would be a compatibility side
(you can use Lag only on PC while you could teorically be able to run x264 on a NAS too)
and a little better compression but that costs an incredibly huge amount of time.

So all in all Lags remains the choice (generally).

For the 8bit 4:2:0 Lossless AVC scenario - FYI lossless profile is HW accelerated supported by NVDec . A fantastic option for 8bit 4:2:0 IMO, high compression ratio, fast decode, low CPU .

Quote:
Originally Posted by Tlen View Post

Out of curiosity, command line for x265 lossless?
For x265 cli
Code:
--lossless
poisondeathray is offline   Reply With Quote
Old 18th April 2024, 06:39   #64  |  Link
Tlen
Registered User
 
Join Date: Apr 2020
Posts: 23
Quote:
Originally Posted by excellentswordfight View Post
Just FYI it can be worth testing x264 in a faster preset
This could be an interesting experiment.

If the the ultrafast (for example) gives me the same performance in terms of ratio/time computing compared to Lagarith, it would have the added benefit of compatibility and (suposedly) hardware accelleration.

Regarding to hw accelleration, MPCH with LavFilter reports that the i5 i'm using would be capable of h264 HW decoding,

but when i decoded the Lossless h264 Cpu was 100% stuck.
If it was really hw decoding capable i would expect totally differrent numbers.

Is it a separate accelleration for lossless?
Or there is problem with the Lav capabilities reporting?

Quote:
Originally Posted by poisondeathray View Post
lossless profile is HW accelerated supported by NVDec
Yes, but in my (and i think many) situation the video is played on a system without a dedicated GPU
but a shared soldered GPU (not Nvidia) and not with NVDec.

Quote:
x265 cli
Thank you

Last edited by Tlen; 18th April 2024 at 06:46.
Tlen is offline   Reply With Quote
Old 18th April 2024, 08:21   #65  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,028
while lossless h264 and h265 are hardware decodable you still need a decoder that actually supports that. there is a lot of codec that are hardware decodable but not added.

as far as i know lavfilter can't do that (have not checked this in years). maybe it was added for nvdec.
try mpv.

and only nvidia.
huhn is offline   Reply With Quote
Old 18th April 2024, 18:52   #66  |  Link
Tlen
Registered User
 
Join Date: Apr 2020
Posts: 23
Here's an update on compression tests

2hours 16min film 1920*1080 YV12

Lagarith
116 Gigs @ 140fps -> Decode (i5) 65% CPU

x264 Ultrafast
130 Gigs @240 fps -> Decode (i5) 45% CPU

x264 Almost 2 times faster with little difference in size and less CPU. Amazing!

I think i found the replacement.

Thank you excellentswordfight for the suggestion!

Ps.
What I don't understand is why LAV filter is hw accelerated (10% CPU on average) with standard x264 compression (ie. Bluray)
and not accelerated with lossless compression.

Last edited by Tlen; 18th April 2024 at 18:55.
Tlen is offline   Reply With Quote
Old 18th April 2024, 20:45   #67  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,412
Quote:
Originally Posted by Tlen View Post

Ps.
What I don't understand is why LAV filter is hw accelerated (10% CPU on average) with standard x264 compression (ie. Bluray)
and not accelerated with lossless compression.
Apparently Intel quicksync does not support lossless AVC decoding - this was confirmed by Intel developer in their forums . So you are using CPU in that case
poisondeathray is offline   Reply With Quote
Old 18th April 2024, 21:35   #68  |  Link
Tlen
Registered User
 
Join Date: Apr 2020
Posts: 23
@poisondeathray
I got the reply in the LAV thread.
It seems lossless encoding works in a completely different way than lossy and is not implemented in (any?) chip, or just Intel?
Tlen is offline   Reply With Quote
Old 18th April 2024, 22:20   #69  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,028
as i said only nvidia has added it and that doesn't mean all decoder can use it.

it's a special profile.
nvidia can even hardware encode lossless.
huhn is offline   Reply With Quote
Old 24th April 2024, 18:25   #70  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,331
Out of curiosity. Is there an FFV1 codec install like there is for UTVideo ?
Allowing use under VirtualDub.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 24th April 2024, 19:13   #71  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,823
Quote:
Originally Posted by Tlen View Post
I don't doubt it will be probably more efficient in terms of pure compression ratio.
IDR only is maybe 30% higher bitrate for typical natural image content. The savings from inter frame compression are proportional to how noisy the content is, so really grainy stuff may not increase bitrate much at all, but clean computer-rendered cel animation might need 3x the bitrate for lossless.

To get the minimum possible lossless file size, x265 --lossless --preset placebo is the best you can get today. However, it is slow.

placebo doesn't make sense for most lossy encoding, it makes a bigger difference for lossless. I've seen placebo come out at a 10% smaller file size than veryslow.

Quote:
But much probably it will be even slower than x264, so at present day perhaps it's not an option, cause of the cpu / time cost,
unless the compression gain is so huge that can balance the cost.
IDR-only is a lot faster than interframe encoding, particularly on systems with lots of cores. You can use an arbitrarily high frame threads count as there's no rate control or frame comparisons needed in this use case; each frame is an entirely independent encode. x265 can useful use more cores per frame than x264 can, so the speed delta might not be that bad, and I wouldn't be surprised if you can encode with x265 faster than x264 aiming for the same file size (x265 --preset medium should still deliver lower sizes than x264 --preset placebo)

Speed versus file size tradeoffs are really for you to figure out for yourself; it's complicated.

If you're worried about decode speed, lossless is a mandatory feature of x265 Main and Main10 profiles, and so you get HW decoder support on modern systems. x264 lossless isn't always accelerated (although is somewhat faster to decode in software).

I am not sure which if any HW encoders support lossless. If you can do it with an Nvidia GPU, you could get very fast encoding, but presumably with some bigger file size.

Quote:
Out of curiosity, command line for x265 lossless?
You just add --lossless. Setting that causes a whole lot of other parameters to be ignored, like profile, level, crf, bitrate. Key remaining ones are --keyint and --profile. If not doing IDR I strongly recommend using a shorter --keyint than the default 250. It can take a really long time to decode all those huge frames in the reference structure for frame 247.

Full command line documentation is here: https://x265.readthedocs.io/en/master/cli.html

And some usefully in depth info about lossless encoding is here: https://x265.readthedocs.io/en/master/lossless.html
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 23rd May 2024, 14:21   #72  |  Link
damian101
Registered User
 
damian101's Avatar
 
Join Date: Feb 2021
Location: Germany
Posts: 21
Quote:
Originally Posted by excellentswordfight View Post
Not sure if x265 lossless mode is "fixed", but when I tried it, it was worse than x264.
I always assumed that x265's quite bad lossless performance was format-related. After all, H.264 has its own lossless profile, while H.265 does not. But a significant benefit for H.265 here is that a lossless H.265 stream should be decodable by hardware decoders.
damian101 is offline   Reply With Quote
Old 23rd May 2024, 14:25   #73  |  Link
damian101
Registered User
 
damian101's Avatar
 
Join Date: Feb 2021
Location: Germany
Posts: 21
Actually, it should (also?) be encoder-related to at least a significant degree. Because, iirc, preset superfast gave me the best lossless compression with x265, which is obviously not how it should be.
damian101 is offline   Reply With Quote
Old 23rd May 2024, 15:13   #74  |  Link
damian101
Registered User
 
damian101's Avatar
 
Join Date: Feb 2021
Location: Germany
Posts: 21
Quote:
Originally Posted by damian101 View Post
Actually, it should (also?) be encoder-related to at least a significant degree. Because, iirc, preset superfast gave me the best lossless compression with x265, which is obviously not how it should be.
Not true anymore. Apparently, preset medium has been optimized.

Also, I'm pretty sure preset superfast didn't give me "the best lossless compression", just the best that wasn't extremely slow.

But x264 still easily beats x265 at much higher speed.

Last edited by damian101; 23rd May 2024 at 15:44.
damian101 is offline   Reply With Quote
Old 23rd May 2024, 15:26   #75  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,235
Quote:
Originally Posted by damian101 View Post
But a significant benefit for H.265 here is that a lossless H.265 stream should be decodable by hardware decoders.
Really!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 30th May 2024, 21:00   #76  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,412
I found an 8bit420 example where x265 lossless outperforms x264 lossless - foreman_cif.y4m . It might be related to the cif resolution. Exceedingly rare for this to happen

x264 keyint 500 , preset veryslow
15,948,130 bytes

x265 keyint 500 , preset veryslow
15,917,148 bytes

yuvsoft
15,475,020 bytes
poisondeathray is offline   Reply With Quote
Old 30th May 2024, 21:47   #77  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,235
Quote:
Originally Posted by damian101 View Post
Actually, it should (also?) be encoder-related to at least a significant degree. Because, iirc, preset superfast gave me the best lossless compression with x265, which is obviously not how it should be.
Quote:
Originally Posted by SeeMoreDigital View Post
Really!
I can confirm it's true!

Using VirtualDub2 I generated a couple of lossless HEVC encodes in 8-bit and 10-bit and they played fine on my old 2016 LG television.
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 6th July 2024, 14:33   #78  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 544
Quote:
Originally Posted by SeeMoreDigital View Post
I can confirm it's true!

Using VirtualDub2 I generated a couple of lossless HEVC encodes in 8-bit and 10-bit and they played fine on my old 2016 LG television.

Like this? Found this on internet, 1 deprecated option, it is not lossless though:

ffmpeg -i through-the-cracks.mp4 -c:v hevc_nvenc -pix_fmt yuv444p16 -profile:v main10 -preset slow -global_quality 6 -g 0 -c:a copy cwqasdcwsa1.mp4


BTW, there was a recent fix with all intra https://github.com/FFmpeg/FFmpeg/com...19781565db01f6
Balling 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 12:45.


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