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 > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th October 2023, 23:16   #1  |  Link
katzenjoghurt
Registered User
 
Join Date: Feb 2007
Posts: 128
Reencoding middle part of an x265 stream / mkv - artifacts at 2nd cut point

Hello,

So sometimes I‘m not completely happy with my x265 encoding and want to only replace certain segments of its stream in the mkv container.

But I fail to achieve this without getting artifacts after merging the new part in. While the transition to the START of the inserted segment seems to be always fine, I‘ll see artifacts for a few frames right where the inserted segment ENDS.

So, if we have
Start----A----B----End
and I replace A to B by a new encoding, point A will be fine but I‘ll see artifacts at B.

That means, if I want to replace a segment, I can always only keep the first part of the video, up to start of the segment I want to replace….and reencode from there up to the end of the ENTIRE video. At least if I‘m not willing to accept artifact glitches.

If I would encode 3 parts (Start to A, A to B, B to End) and merge them together its also fine.
The problem seems to occur when cutting and adding a new clip IN FRONT OF a cut-off point.

A known issue?
Can I do something about it?

Tools:

StaxRip v2.29.0
x265 (Patman‘s build contained in StaxRip 2.29.0)
Current MKVToolnix
Current VLC

Last edited by katzenjoghurt; 26th October 2023 at 23:30.
katzenjoghurt is offline   Reply With Quote
Old 27th October 2023, 15:03   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,424
2cents from me:
Not much data to go on, no info how you split, merge and what settings you use for reencoding, what settings the rest was encoded with or what artifacts you see,...
a. do you use compatible x265 parameters?
b. do you enable https://x265.readthedocs.io/en/stabl...repeat-headers
c. do you only cut on IDR frames?
if not, look into those.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 22nd November 2023, 14:50   #3  |  Link
katzenjoghurt
Registered User
 
Join Date: Feb 2007
Posts: 128
Quote:
Originally Posted by Selur View Post
2cents from me:
Not much data to go on, no info how you split, merge and what settings you use for reencoding, what settings the rest was encoded with or what artifacts you see,...
a. do you use compatible x265 parameters?
b. do you enable https://x265.readthedocs.io/en/stabl...repeat-headers
c. do you only cut on IDR frames?
if not, look into those.

Cu Selur
Hey Selur,

sorry for replying so lately.
I read it immediately, read your suggestion with repeat headers, added it to my encoding and it didn't help.
I took some more time now to go back to the basics.

Here are the details.
1) I grabbed a 1min20s clip

2) x265 build used:
http://msystem.waw.pl/x265/x265-3.5+...vs2022-AVX2.7z

3) I used StaxRip for reencoding.
Under the hood it's using this basic command line for reencoding:

Code:
"E:\StaxRip\x265\Apps\avs2pipemod\avs2pipemod64.exe" -y4mp "C:\Temp\VID1 Lorem ipsu..._temp\base_reenc.avs" 
| "E:\StaxRip\x265\Apps\x265\x265.exe" --crf 20 --frames 4000 --y4m --output "C:\Temp\VID1 Lorem ipsu..._temp\base_reenc_out.hevc" -
3) I opened MKVToolnix 79.0.0 and added the .hevc stream

4) In MKVToolnixes output settings I chose
Split mode: "After output duration"
Duration: 00:00:30

5) The output were 3 mkv files and I reencoded the middle part with the same x265 settings:
Code:
"E:\StaxRip\Apps\avs2pipemod\avs2pipemod64.exe" -y4mp "C:\Temp\VID1 Lorem ipsu..._temp\base_reenc_out-002_new.avs" 
| "E:\StaxRip\Apps\x265\x265.exe" --crf 20 --frames 1734 --y4m --output "base_reenc_out-002_new_out.hevc"

What I observe:
After splitting I have 3 parts (A, B, C)

- If I check the first few frames of the original split part B in Staxrip they are duplicates

- These duplicates are also in the reencoded B

- After merging A, B_new and C I see the duplicate frames at the transition from A to B and erratic frame jumps between B_new & C.
In Staxrip's frame preview I even see a huge artifact at the transition point from B_new to C. It's not visible in VLC though.

- If I reencode the resulted merge file once more, all the errors are still there


edit: The problem doesn't occur with x264
edit2: double checked it: "--repeat headers" for x265 makes no difference

Last edited by katzenjoghurt; 28th November 2023 at 19:41.
katzenjoghurt 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 17:35.


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