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. |
16th September 2020, 09:17 | #1 | Link |
Registered User
Join Date: Mar 2005
Posts: 89
|
Most compatible x264 50p/60p encoding settings
Hi,
I am trying to figure out how to encode my AVCHD videos (1080i50) in a "future proof" way. I tend to agree to people saying that progressive output is the future, interlaced is legacy and thus a QTGMC deinterlacing step is recommended, working then with 50p/60p content. I did some comparison between the 50i and the deinterlaced 50p material e.g. with Kodi on an Odroid-N2, and there is indeed less flickering with the 50p material. But there are of course also slight artifacts in the 50p material, and as technology emerges, deinterlacing algorithms in software and hardware still might become better, so I also see a reason keeping the material interlaced (since I seldom use zooming effects, rotation etc.). But on the other hand, I am not aware of an open-source NLE that correctly supports correct interlace editing and output. Davinci Resolve might be an alternative, but I have to check if FFMPEGs ProRes output is compatible - I read about problems... But the most important question for me is: How do I encode the 1080p50 material in the most hardware-compatible and future-proof way? I remember the MPEG-4-ASP hell back in the 2000s (DivX, XviD, experiments with GOP sizes etc. and only chinese players that supported them), and I donīt want to generate output that only works on my devices without stuttering etc. and might have to be reencoded for future devices due to some incompatible parameters. Therefore, I used the x264 Blu-ray settings from https://sites.google.com/site/x264bluray with AC3 put into an MKV container as I thought the x264 settings to be a kind of "common sense" that every decoder chip must support. But 50p/60p is out of the BD specs, and I donīt know if simply changing the level to 4.2 and settings the keyint to 50 or 60 is the right way to go. And since it is really not BD compatible, does it make sense to keep the --bluray-compat parameter? Does the UHD-BD support 50p/60p, and are compatible settings available? Is there some detailed information how YouTube or VOD videos are encoded or if there is some "common sense" regarding the encoder settings? Or are the current AVC decoder algorithms in hardware much more tolerant to some extend? Thanks in advance for any hints! |
17th September 2020, 06:54 | #2 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
You're right, H.264 per se doesn't allow 50p/60p in BDs as they're not standard, so the only way to get 50fps or 60fps and still following the specs would be to keep them interlaced.
On the other hand, this isn't true with H.265 as everything that is aired with HEVC in PAL land is 50p. For instance, movies that were originally 23.976p are speeded up + pitch adjusted by 4% to 25p and then frames are duplicated to get 50p. In other words, you're probably gonna have more luck in terms of compatibility with a 50p H.265 than you would with a 50p H.264. As to deinterlacing it yourself or leaving it as it is, I gotta say that you're right in saying that deinterlacers have become better and better; as a matter of fact, TVs are so powerful now that not only generally deal with interlaced contents in a pretty good way by bobbing them up to 50p/60p, but they're even able to detect if a stream is 25p and only flagged as 25i (and they generally interpolate it up to 50p). So, all in all, the decision is yours; me, personally, I wouldn't deinterlace them just yet as pretty much everything is now able to deal with those in a pretty good way, however if you do wanna use QTGMC and its cleaning/deflickering effects at the expense of re-encoding it (and thus making the lossy of the lossy), I would go with H.265 10bit and something that very broadly looks like: Code:
ffmpeg.exe -i "AVS Script.avs" -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --tune fastdecode --no-high-tier --ref 4 --profile main10 --crf 18 --deblock -1:-1 --min-luma 64 --max-luma 940 --chromaloc 0 --range limited --videoformat component --colorprim bt709 --transfer bt709 --colormatrix bt709 --overscan show --no-open-gop --min-keyint 1 --keyint 50 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --wpp -o "raw_video.hevc" You could also go for a two pass approach specifying the bitrate instead of --crf if you want. Otherwise, if you wanna convert it from Linear BT709 SDR to Linear BT2020 SDR with something like: Code:
ConvertYUVtoXYZ() ConvertXYZtoYUV(Color=1, pColor=2) Code:
ffmpeg.exe -i "AVS Script.avs" -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --tune fastdecode --no-high-tier --ref 4 --profile main10 --crf 18 --deblock -1:-1 --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer bt2020-10 --colormatrix bt2020nc --overscan show --no-open-gop --min-keyint 1 --keyint 50 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --wpp -o "raw_video.hevc" Cheers, Frank Last edited by FranceBB; 17th September 2020 at 07:00. |
17th September 2020, 10:58 | #3 | Link |
Registered User
Join Date: Mar 2005
Posts: 89
|
Thanks a lot for your detailed information. I havenīt taken a look at x265 yet due to the expected longer encoding times.
Reencoding the whole stuff is not the point in my case because I am not aware of any really reliable and affordable video editor that supports AVC smart rendering on non-gop boundaries, but the most important reason is that I use the VirtualDub deshaker, so a reencoding is necessary anyway in the process, and I intend to use the ffmpeg ProRes codec until I finally output the result and compress it again to h264 or h265. "To deinterlace or not to deinterlace" remains the question, and I might give DaVinci Resolve another try as long as it correctly handles the FFMPEG ProRes stuff - I donīt want to spend 100s of € just for the trimming of (deshaked) clips and adding transitions between them (like mentioned, I seldom do color correction, keyframe animation etc. for this kind of stuff). Cheers, Joerg |
17th September 2020, 17:14 | #4 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
|
https://forum.doom9.org/showthread.php?t=154533
1280x720x50.000p / 59.94p is perfectly legal on BD, commandline suggestions are there and I am using this regularily if 25i/29,97i sources come in and optical discs are wanted. Only if source is really worth 1920x1080, well then... Bust most are not, downsizing from the usual 1440x1080 HDV cam with CCD means no real loss in detail, even from most 1920x1080 HDV cams. And I suggest to keep your sources anyway. I would expect that with the advent of AI resizing interlaced SD/HD/FHD sources can be upconverted to double framerate AND uprezzed even more convincing as with QTGMC now, as much as I like it still, and for the last 10 years. One more year and we are there.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." Last edited by Emulgator; 17th September 2020 at 17:16. |
17th September 2020, 21:10 | #6 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
|
Quote:
For example, knowing that a detail only existed in one set of fields instead of both is an important clue as to how it motions, and would impact certainty for whether a given pixel is part of a sharper or smoother region. That said, it's surprising how little the best deinterlacing today is than the best deinterlacing a decade ago. The average implementation has improved a bunch, but the sources that drove me crazy in 2008 still drive me crazy today. Nothing does real fire-and-forget for random cadence edits of mixed 3:2, 30p, and 30i frames and frames that blend those elements. Which is pretty much most TV made from 1988-2004 or so. Pop a first season episode of MacGuyver or Family Guy into any workflow system and it's still going to have problems without a fair amount of manual tweaking. Back to the original post, which wasn't Blu-ray specific, a Profile 4.2 1080p50/60 .mp4 file is almost universally playable today, and will be just as playable >>10 years into the future. We'll be seeing new, widely distributed content being encoded in H.264 for 5+ more years. There just isn't any new codec promising as broad support as H.264 has has for a while now. Qualcomm doesn't have AV1, Stock Android and Chrome/Firefox don't have HEVC. I think .mp4 is more future proof than MKV, as it is already much more broadly supported today. Only reason to use MKV is if there are features of it not broadly supported in MP4. As for audio, I'd strongly consider using AAC-LC over AC3. Lots of devices today don't support AC3 out of the box (Android, iOS), which essentially everything does AAC. However, there are legacy players that don't do AAC-LC at more than stereo, so if it is 5.1 content, AC3 might still be considered. EAC3 is probably okay too; only stuff >10 years old supports AC3 but not EAC3 these days. |
|
19th September 2020, 23:22 | #7 | Link |
Registered User
Join Date: Mar 2005
Posts: 89
|
Regarding processing algorithms, I am/was not sure if there is an interest by the industry in improving deinterlacers if all the world uses VOD services with progressive sources and if the average user does not care about quality. So why would a chip manufacturer invest time and money when the future is progressive? Or is there in general research for the professional area that later on gets adopted in consumer devices?
I thought about the MKV situation, but I believe it to be something like DivX (AVI with MPEG4ASP) that also lasted for quite a while and still works: As long as the community supports it, it will be alive - and it is the standard format there. Even most TVs support at least basic playback to my knowledge, and I also donīt think that the Kodi app is gonna die... Otherwise, and thatīs why I ask about compatibility, I would "repackage" it from MKV to MP4 like I currently do with VOB to MKV or create M-Disc BDs, even though the media might last longer than the drives... - we will see. But the latter requires the content to be BD compatible of course, thatīs why I also asked about possible UHD-BD 50p compatiblity. But after all the recommendations, I think in fact to keep it interlaced anyway. And thanks for the hints regarding the video codec choice. The audio aspect is quite interesting. But since I created tons of miniDVDs and DVDs within the last 20 years and the original AVCHD videos also contain an AC3 track, I would leave it as AC3 for now. I also donīt think that amplifier are going to stop supporting it. And it is so much content, that I can only keep the sources for a few personally very important videos, thatīs why I want to edit it in the best quality as possible and want to output it at a reasonable size (=bitrate). Itīs not about professional/commercial content, "just" private memories. |
20th September 2020, 01:14 | #8 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Quote:
|
|
20th September 2020, 18:16 | #9 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
The Deshaker guide, unless I'm reading it incorrectly, implies it works better if you de-interlace first. There's a section with a heading "Stabilizing Interlaced Video".
http://www.guthspot.se/video/deshaker.htm Maybe you'd be better off de-interlacing to 50/60fps with QTGMC, and given 1080i has roughly the same spacial resolution as 720p, you could downscale to 720p after deshaking and leave it at 50/60fps, and most devices these days should play it, even Bluray players with a USB input, as every player I've come across supports at least High Profile, Level 4.1 in an Mp4 or MKV, no Bluray compatibility encoder settings required. You mightn't want to downscale, but it might be worth comparing deshaking with and without deinterlacing first, or maybe someone with experience using deshaker (I've had almost none) can offer an opinion on that. |
Thread Tools | Search this Thread |
Display Modes | |
|
|