Assistance with StaxRip

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
I always use dgdecode for DVDs and I'm not letting anything mess around with the picture before I deinterlace since as you say, it'll disturb the deinterlacer, unless the source has an issue that require it and I absolutely have to, but deblocking isn't part of that.

I just provide the d2v file like so:
Vid1 = DGDecode_mpeg2source("K:\_2enc_\_ISO\LPFD-214\LPFD-214.d2v")

Here's what my rip looks like if I upscale it with madvr before saving the picture:
Upscale_LPFD-214_hevc_10bit.mkv_snapshot_38.12.051.png

I think I have the right frame but it's hard to tell with the processing you're doing, the final result seems shifted a bit and your picture is 5 pixels larger, but I did crop 2 pixels from each side to get rid of black bars before encoding, although I don't see black on yours either.

I find yours to be quite a bit blurrier than mine and the png compression agrees, my screenshot is almost 500kB bigger.

Me using 10bit might help the red wall to appear less blocky since it allows for better gradients so the transition is smoother between colors. Might also be your color change that makes it seem worse in yours too.
 

Kevin_san

Member
Nov 24, 2015
55
14
SamKook, this is great technical quality, of course. All remarks are valid.
But - "What is in for me?"
Meanwhile I have downloaded your x265 version so I can compare frames independently.
To me it is not about "invincible" QTGMC, but I want to achieve certain features that it does not have right now.
On my side now the project is kind of matured, so I can consider to carry that into a 10bit QTGMC implementation that will be enhanced with convolution and a color option.
I'm proud to see what is possible without.

I see it more from the viewpoint of engineering. You construct (and in a different structure sell) a product that is never the highest quality solution, that no one can afford, but what is "good enough" to be acceptable on a market.
For the lurkers, obviously even a 1-knob conversion is acceptable and my solution is x times better than that, and costs little CPU load.
But for this, one has to be very conscious about the details that we do and that we don't.

The package for me is the following (listed randomly):
For many of these "difficult" ISOs I need the deringing in the mpeg2source() function, and set the deblocking thresholds quite high so it's mostly inactive. It makes a difference.
To my eyes the artifact correction wins a lot more than what the shimmering loses, I have no problem with interlace bobbing etc., most time it is mild or invisible.
I have a particular issue with most idol DVDs, and BlueRay are normally not prone to that.
The color on most players looks ugly and yellow-ish. The sharpness is just totally wrong, it has a maximum at radius 2 which enhances skin texture in a way that makes the girl look older. Compared to BR it is exaggerated, to pretend resolution where there isn't.
Really, what is the meaning of blurred here, I have no interest in counting pimples. I dislike the exaggerated skin textures in the notorious DVD mastering.
To me, blurred means edges, and radius 2 does not deliver sharp edges. They would require bigger file size but they cram a 100 minutes of garden and swimmingpool into 4G of MPEG2, so it is all about salvage of at least some edges, and using a denoiser, and somewhere massive deblocking has to take place. x264 does simple versions of that anyway.
Somehow, perhaps psycho-optics play a role, the upsampling together with the convolution creates an impression of enhanced resolution, even when it is only in some parts of the frames, and the motion prediction can carry that a long way, averaging out some noise and some distortion. Works very well with screens of 2048x1024.
What to look for: width of small details. With the original and most encodes, grass, twigs in trees, carpet patterns all have a width of 1px, if they have a corresponding distance to the lense. But with upsampling, width starts to vary, and intensity/luma value starts to vary even more. You can't do this without convolution.
The color processing was tuned to go into a direction of music video (like Blackpink..), or holiday postcards with deep blue sea and heaven. These music videos are pieces of art, but technically we can find a lot of issues like with the direct frame comparison, sometimes blurred flat regions.
Actually I love the blocking in that deep red-brown area, because it is so big that otherwise it looks boring. Depending on the source, and with tweaking the encoder settings, there may be a lot of dithering, which can be used like grain.
But when I am on the beach, I see no grain in the sky. This is what I seek. Very deep colors, perhaps some psychedelic "smoke", and nothing that reminds me of usual digital.
Some videos come quite close to that.
Currently, I'm tweaking ENFD-5176. There is a file around, that has 3.4G and does not even have real 60fps, every 2 frames are identical. The file size comes from minutes full with straw or grass, and walking through a creek with glittering reflecting sun light. Aready the original has a total overflow here, although it is 6.3G.
Right now I am at 3.8G with more sharpness and real 60fps.
Happy encoding!
 
Last edited:

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
There's a reason using the word "best" is banned on doom9, what one person think is best might not be the same as another person and might change depending on the video. This is not the first example of us having different taste.

I use QTGMC because the shimmer bothers me a lot, but ringing is basically invisible to me and I like detail(I thought there was something wrong with the lamp in the background of my screenshot after looking at yours, but noticed there's a 90 degree bend I didn't see in yours. Totally useless for something out of focus but I like it, lol). I read one of my comment about a video I had an issue with years ago since I was reencoding it now and saw I said there was a red halo around the girl, which I hadn't even noticed and had to look for a min to find it and it was everywhere.

There's also many other filters for deblocking/dehalo/deringing : http://avisynth.nl/index.php/External_filters#Deblocking so it may or may not help to use those after the deinterlacing step instead.

Filmmakers do seem to prefer warmer tones for color rather than colder ones, or they don't bother with it and most house light have a warm tone so that's what happens. I don't really have a preference personally.

There's endless experimentation to be done and you learn something new everyday if you look for it so it's never a bad thing to do.
 

branbran726

Well-Known Member
Nov 5, 2021
554
710
How would I go about splicing a piece of video into a longer feature in StaxRip?
I'm looking to share BUNK-044 (NSFW), which has a ~10 minute multi-angle segment where Nao does a series of exercises, with clothes in one angle and without clothes in the other angle. Unlike a lot of works with multi-angles, though, it seems like it wouldn't break the flow of the video to encode it into the main track, and it would make it easier to preserve the entire contents in one video rather than trying to ZIP it all together and hope it sticks.

I imagine one could use something like MakeMKV to get the main track w/nude exercise + the bonus 10-minute clothed exercise segment, combine them into one long temporary .mkv file so that StaxRip can process it all at once, and then re-arrange the parts using the cutting functions... but I do not know the syntax to use.

Here's the ISO if someone wants to take a look. The parts are the same on each host, so a free user could grab half from one and half from the other.
BUNK-044.zip.001 (950.0 Mb)
BUNK-044.zip.002 (950.0 Mb)
BUNK-044.zip.003 (950.0 Mb)
BUNK-044.zip.004 (950.0 Mb)
BUNK-044.zip.005 (950.0 Mb)
BUNK-044.zip.006 (950.0 Mb)
BUNK-044.zip.007 (950.0 Mb)
BUNK-044.zip.008 (577.4 Mb)

BUNK-044.zip.001
BUNK-044.zip.002
BUNK-044.zip.003
BUNK-044.zip.004
BUNK-044.zip.005
BUNK-044.zip.006
BUNK-044.zip.007
BUNK-044.zip.008
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
Just use the merge files option when you load it if you have them as separate files or load one mkv with everything. I forget how multi angles are dealt with when loaded through VTS, but it doesn't matter as long as you can load everything. After that, you basically just need to cut and join the parts in however way you want them to be.

Just using trim() and ++ and you can order/re-order the video however you want.

Lets say the 2nd angle is frames 10000 to 11000, the video is the first 10k frames and you want the 2nd angle after frame 2000.
Code:
Trim(0,2000)++Trim(10000,11000)++Trim(2001,9999)
That would do it.


BTW, you can also do a multi angle type thing with mkvs using ordered chapters. I've done lesbians only edits for the purists of mixed hetero/lesbian movies where you can select to either see the full movie or just the lesbian parts, but everything is in the same file, you just gotta choose what you wanna see in the player.
You can also do the same with separate files using segment linking. The main video can load other files as if they were part of the main video so mixing ordered chapters and segment linking is also an option if you don't want everything in the same file.
Been a while since I messed with that stuff so might not be 100% accurate but should be close enough, definitely possible to do all that for sure though.
 
Last edited:
  • Like
Reactions: CoolKevin and Porni

branbran726

Well-Known Member
Nov 5, 2021
554
710
Thanks for the help again, @SamKook . The splicing worked to rearrange and re-insert the video just fine, but the audio didn't move with it. I merged [main track + bonus segment] into one file, used the Trim function to arrange [intro + bonus segment + resume main track], but while the video moved properly the audio stayed in the same place, with the main track audio playing until its end and then the bonus track audio playing over what should be the last ~10 minutes of the main track.

Could it be because I hijacked the Resize text box to do it instead of using the Cutting box?
Or is it because I put/didn't put a space after a comma somewhere...
 

Attachments

  • 1666475227140.png
    1666475227140.png
    123.2 KB · Views: 105

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
Oh, right, Staxrip doesn't like when we trim the video manually, I forgot. If I remember right, it won't even accept it properly even if you modify the cutting section.

The audio isn't processed by the same avisynth script as the video which is why that happens. That's what I do manually to make sure the audio always fits.

So... I'm pretty sure you'd have to do the reordering using the preview thing but as far as I can tell, that's not possible so it might not be possible to do it with staxrip. You'd have to ask on their forum or directly to the dev if it's possible to somehow change the order of video sections.


I tried messing with the project file and manually editing the cut in there since it won't save it to the project if you manually change it and it breaks the project so that's not an option.
From looking at the log file, it's cutting the audio with mkvmerge and a dummy temporary video file so even if we could edit it, I'm not sure it could handle reordering the audio
I tried making an avisynth script for the audio instead of using the ac3 file directly but avisynth complains if there's no video and you want to trim it and if you add a video then mkvmerge doesn't recognize it as audio anymore and will refuse to process it.

The only way I have left to make this work would be to encode the audio manually using the trims you use for the video and use that as a source for the audio


Why do I even bother writing stuff before I actually give up trying to find a solution.

The workaround for it I found messing with staxrip interface would be to manually create an avisynth script for the audio and add the same trims in there, load that as the audio source and use command line as the encoder so it uses ffmpeg to encode the audio using the avisynth script.

In the temporary folder staxrip creates when you load a source(located in the same folder as that source), find the avs file with the source name which should have something like the following inside(but a different plugin since you use a mkv instead of the vob stuff, same principle applies though):
Code:
AddAutoloadDir("C:\Progs\StaxRip-v2.13.0-x64\Apps\FrameServer\AviSynth\plugins")
LoadPlugin("C:\Progs\StaxRip-v2.13.0-x64\Apps\Support\DgMpgDec\DGDecode.dll")
MPEG2Source("K:\_2enc_\_ISO\GON-313\VTS_02_1_temp\VTS_02_1.d2v")
Copy that file and give a name related to audio that you'll recognize and open it with a text editor like good old notepad.
You'll keep the video stuff from the original file and add the audio stuff which should look something like this but with paths appropriate to your pc:
Code:
AddAutoloadDir("C:\Progs\StaxRip-v2.13.0-x64\Apps\FrameServer\AviSynth\plugins")
LoadPlugin("C:\Progs\StaxRip-v2.13.0-x64\Apps\Support\DgMpgDec\DGDecode.dll")
LoadPlugin("C:\Progs\StaxRip-v2.13.0-x64\Apps\Plugins\AVS\NicAudio\NicAudio.dll")
Vid = MPEG2Source("K:\_2enc_\_ISO\GON-313\VTS_02_1_temp\VTS_02_1.d2v")
Aud = NicAC3Source("K:\_2enc_\_ISO\GON-313\VTS_02_1_temp\VTS_02_1 ID0 2ch 448Kbps.ac3")
AudioDub(Vid,Aud)
Also add your trims after the AudioDub line.

Then in staxrip you load that file as the audio instead of the ac3 file and instead of "Copy/Mux" or whatever else you were using, pick "Command Line" or better yet, go to "Edit Profiles..." and clone the Command Line one to something new(rename to avs source or something like that) since we'll be editing it a bit.

Once selected, click edit on the right and set the settings to match the profile you were using previously(select that profile first and go in edit to see the details).
For example, if you wanted to encode the audio to opus, which is what I use now thanks to porni, you would copy the ffmpeg command at the bottom in that profile that says "ffmpeg -c:a libopus -b:a 250k -ac 2", go back to the source you created or the command line one if you didn't and change
Code:
"%app:ffmpeg%" -i %input% -b:a %bitrate%k -y -hide_banner %output%
to
Code:
"%app:ffmpeg%" -i %input% -c:a libopus -b:a %bitrate%k -ac 2 -y -hide_banner %output%
, put 250 in the bitrate box above instead of the default 640, change the output file type to opus and the Channels to 2 since it's almost certainly stereo(don't if it isn't), but not sure if it actually gets used or not.
Then click the down arrow next to the ok button and save the profile and you should be good to go.

A bitrate of 128(which is what I use) would be more appropriate for opus since 250 is way overkill(unless the ffmpeg version is somehow different than the official encoder but I'm pretty sure it uses the same library) and you could even go as low as 64 if you wanted to save some space.

Make sure to keep hijacking a section for your trims and not use the proper cutting section or that would mess things up.
 
Last edited:
  • Like
Reactions: CoolKevin

branbran726

Well-Known Member
Nov 5, 2021
554
710
Thanks for taking a look. What, if anything, should be different in that configuration if I'm using FFVideoSource instead of Mpeg2Source? The contents of my .avs file look very different, and I'm not sure how much of that is because I use a different Source function, or because I'm using .mkv instead of combined .vob, or whatever else.

Code:
AddAutoloadDir("C:\Program Files\StaxRip-v2.13.0-x64\Apps\FrameServer\AviSynth\plugins")
LoadPlugin("C:\Program Files\StaxRip-v2.13.0-x64\Apps\Plugins\Dual\ffms2\ffms2.dll")
tcFile = "C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\B1_t01_merged_timestamps.txt" # timestamps file path
Exist(tcFile) ? FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex", timecodes=tcFile) : FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex")

Notably one thing that is not loaded in that sequence is DGDecode.

Anyway, is this the file I'm meant to copy and make into the dummy audio file?
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
Yeah, that would be the file.

It's normal you don't have dgdecode since you're not using the vob files with mpeg2source, the filter used here for the mkv is ffvideosource which is contained in the ffms2 dll.

I didn't expect there to be logic though since it also uses a timestamp file which may or may not be present for something.
I think simply adding the "vid = " before the 2 FFVideoSource should do it for the video stuff part, as long as it doesn't mess with the logic. I never needed to use that in my scripts so not sure if that'll work but should.

So you'd have something like this:
Code:
AddAutoloadDir("C:\Program Files\StaxRip-v2.13.0-x64\Apps\FrameServer\AviSynth\plugins")
LoadPlugin("C:\Program Files\StaxRip-v2.13.0-x64\Apps\Plugins\Dual\ffms2\ffms2.dll")
LoadPlugin("C:\Program Files\StaxRip-v2.13.0-x64\Apps\Plugins\AVS\NicAudio\NicAudio.dll")
tcFile = "C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\B1_t01_merged_timestamps.txt" # timestamps file path
Exist(tcFile) ? Vid = FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex", timecodes=tcFile) : Vid = FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex")
Aud = NicAC3Source("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\[Whatever file you have in the audio section]")
AudioDub(Vid,Aud)
Trims here

Edit: Should have said this but in case it doesn't work, you can also get rid of the logic. If the file B1_t01_merged_timestamps.txt exist, use the following instead of the Exist... line
Code:
Vid = FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex", timecodes=tcFile)
And if it doesn't exist, use
Code:
Vid = FFVideoSource("C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged.mkv", cachefile="C:\Users\[name]\Videos\DVD-ISO\BUNK-044\B1_t01_merged_temp\temp.ffindex")
That way it'll work for sure.
 
Last edited:

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,737
5,131
I was messing around with ordered chapters stuff to remember how it works and figured I'd take a screenshot to give you a real example of what it looks like:
EditionsAndOrderedChapters.jpg

I put the 2 angle back to back inside the same mkv, created 2 editions with ordered chapters(the difference between normal chapters and those is that it only shows the stuff between the start and end time of each chapters, nothing else) and a tag file to rename the editions names.

So when you go into your player splitter(the thing that handles the container, mkv in this case) menu, you can choose between the 2 sets of ordered chapters and you'll only see the selected version during playback. As you can see the duration displayed on the player is 9m53s instead of double that.