View Full Version : Inconsistent behavior of script in Avspmod vs ffmpeg
Mawazi
21st December 2018, 23:49
I'm having a frustrating issue.
I have two scripts for converting Doctor Who back to 25fps from the 1080i60 contained on the Blu-rays.
The first script just runs QTGMC which gives me 1080p60, but with duplicates. I put this through ffmpeg using hevc lossless.
Then the second script loads that lossless mkv file and puts it through srestore.
This seems to mostly work. However, viewing that second script in Avspmod, everything looks very smooth frame to frame. When I encode that same script using ffmpeg, there are issues. A repeated frame, then skipping the following unique frame. This mainly happens in scenes with little motion, like two vehicles moving towards each other on a road, filmed from a long distance.
Is there any known reason for this inconsistency?
Thanks.
Cary Knoop
22nd December 2018, 00:03
I would first determine what the source actually contains.
If the original was recorded 25p and sped down to 24p and telecined to 60i you should use an inverse telecine operation, not QTGMC, and optionally a speed up if you want to get the original 25p speed back.
But if the original was 50i and now it is 60i there could be all kind of things that have happened. In that case you have to scan frame by frame and see if you can detect a pattern to determine the best approach to take.
wonkey_monkey
22nd December 2018, 00:09
Could ffmpeg be accessing frames out of order for some reason? That will stuff srestore up.
PS Which blu-rays are these?
poisondeathray
22nd December 2018, 00:22
As usual, post your script(s)
What format was the ffmpeg output, and how are you checking it? How do you know it's not a decoding/playback issue of the ffmpeg output ?
Post your ffmpeg commandline . Double check your framerates. "1080p60" isn't really 60.0 fps . A discrepancy between avs framerate and -r entered for ffmpeg can cause these sorts of issues too
Another possible culprit might be the source filters used
Was it I-frame HEVC lossless after the 1st step ? Any reason for using HEVC ?
Mawazi
23rd December 2018, 00:32
Thank you everyone for your responses.
Indeed, it ended up that I was overthinking it (or, at least, wrongly thinking it) using QTGMC and srestore.
I found that tfm(mode=5) and tdecimate(cycle=6) did the job just fine.
Sorry for wasting everyone's time.
Here's my final (famous last words) script:
FFmpegSource2("DOCTOR_WHO_SERIES_6_SPECIAL_EDITION_BOXSET_DISC_2.Title801.mkv", atrack=-1)
tfm(mode=5,pp=0)
tdecimate(cycle=6)
before=last
removegrain(mode=17)
repair(last, before, mode=17)
assumefps(25,sync_audio=true)
ssrc(48000)
I'm not 100% sure that I'm using repair properly, as I couldn't find too much information on exactly how it works.
Mawazi
23rd December 2018, 00:58
As usual, post your script(s)
What format was the ffmpeg output, and how are you checking it? How do you know it's not a decoding/playback issue of the ffmpeg output ?
Post your ffmpeg commandline . Double check your framerates. "1080p60" isn't really 60.0 fps . A discrepancy between avs framerate and -r entered for ffmpeg can cause these sorts of issues too
Another possible culprit might be the source filters used
Was it I-frame HEVC lossless after the 1st step ? Any reason for using HEVC ?
Though I figured out the 'correct' way to do it, the issue I ran into is still an interesting one.
Yes, HEVC lossless (-x265-params "lossless=1") with the first step. HEVC seemed to provide a smaller lossless file than other options I had tested, but my tests certainly weren't exhaustive. I only had around 400GB of free space on the HD, didn't want to fill it up.
I used ffmpegsource2 for both step 1 and step 2, with the original container being mkv (ripped using DVD Fab).
First script:
FFmpegSource2("DOCTOR_WHO_SERIES_6_SPECIAL_EDITION_BOXSET_DISC_2.Title801.mkv")
qtgmc(preset="very slow",nneurons=4,sourcematch=3,matchpreset="very slow",tr2=1,lossless=2,matchenhance=1.0,noiseprocess=0,edithreads=1,fftthreads=1)
#srestore()
prefetch(8)
Second script:
FFmpegSource2("s6e2-hevc-lossless1.mkv")
#qtgmc(preset="very slow",nneurons=4,sourcematch=3,matchpreset="very slow",tr2=1,lossless=2,matchenhance=1.0,noiseprocess=0,edithreads=1,fftthreads=1)
srestore()
#prefetch(8)
Unfortunately, I don't have the exact ffmpeg command, as my PC restarted overnight and I lost my cmd history (and I hadn't copy-pasted it to a txt file, which I usually try to do).
They were very basic commands, though, very close to:
ffmpeg -i dw3.avs -c:v hevc -x265-params "lossless=1" s6e2-hevc-lossless1.mkv
ffmpeg -i dw4.avs -i originalmkv.mkv -map 0:v -map 1:a -c:v hevc -tag:v hvc1 -crf 20 -preset slow -c:a ac3 -b:a 320k -map_metadata -1 s6e2-final.mp4
The tag:v hvc1 is there to make the file play through Apple TV, also why I used mp4 as the final container.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.