View Full Version : Repeated frame removal - 1 in every 23 frames
mariner
25th August 2012, 19:02
Greetings.
This one is strange: the BD appears to have been encoded with one repeated frame inserted for every 23 frames, resulting in very jerky motion. Frame rate is 23.976 progressive.
How can one remove the repeated frame, ideally without "re-encoding", or perhaps even in real time playback? And what to do with the audio and subtitles?
The BD is Zang Ao Duo Ji, a Japanese/Chinese animation.
Many thanks and best regards.
Sample (http://depositfiles.com/files/typlphevm)
Sample (http://www2.zshare.ma/wlvmoq0cuihx)
Guest
26th August 2012, 00:57
You can't fix it without re-encoding. You can run an Avisynth script for re-encoding or for real-time playback:
TDecimate(cycleR=1,cycle=23)
You'll end up with a weird frame rate, though.
mariner
28th August 2012, 12:50
You can't fix it without re-encoding. You can run an Avisynth script for re-encoding or for real-time playback:
TDecimate(cycleR=1,cycle=23)
You'll end up with a weird frame rate, though.
Thanks for the kind reply, neuron2.
A few questions:
1. Does it start from frame 1? Or does it identify the repeated frame?
2. What frame rate do you suggest to use for reencoding the decimated video stream? Same as the original, 23.976?
3. What software should I use to speed up/resample the audio stream to match the new video stream? Do I do 24/23 speed up? Can it be done keeping the same pitch?
4. Same for subtitle?
5. Is this due to some obscure anime cadence confusing the splitter? Or is this a genuine error in the encoding encoding?
Many thanks and best regards.
Guest
28th August 2012, 14:05
1. Does it start from frame 1? Or does it identify the repeated frame? It identifies the repeated frames, usually very successfully.
2. What frame rate do you suggest to use for reencoding the decimated video stream? Same as the original, 23.976? It depends on your targeted device. That would be a good choice, as it remains close to the original.
3. What software should I use to speed up/resample the audio stream to match the new video stream? Do I do 24/23 speed up? Can it be done keeping the same pitch? You can do it simply in Avisynth as follows:
vid=dgsource("mastiff.dgi")
aud=nicac3source("mastiff PID 1101 3_2ch 48KHz 448Kbps DELAY -25ms.ac3",2).delayaudio(-0.025)
audiodub(vid,aud)
tdecimate(cycle=23,cycleR=1)
assumefps(23.976,sync_audio=true)
That will not correct the pitch but maybe it is good enough.
If you want to correct the pitch, look at TimeStretch(), although I could not make it work for changing the decimated 22.934 to 23.976. Maybe an audio expert will chime in on that. Alternatively, you can use an external application like Audacity to change the audio rate without changing the pitch.
4. Same for subtitle? Sorry, I've no experience there. Try the Subtitles forum, I've seen threads there about resampling.
5. Is this due to some obscure anime cadence confusing the splitter? Or is this a genuine error in the encoding encoding? It's in the encoding, as I see it with my tools, which do not use a splitter.
mariner
3rd September 2012, 12:51
Thanks again, neuron2.
Got the following error message:
Scripte error: there is no function name "dgsource"
Created the following .avs file and played in MPC. What else is amiss?
vid=dgsource("mastiff.dgi")
aud=nicac3source("mastiff PID 1101 3_2ch 48KHz 448Kbps DELAY -25ms.ac3",2).delayaudio(-0.025)
audiodub(vid,aud)
tdecimate(cycle=23,cycleR=1)
assumefps(23.976,sync_audio=true)
Guest
3rd September 2012, 14:34
dgsource() is a source filter available in the DGDecNV package.
You may use any other source filter that you have access to.
mariner
13th September 2012, 12:31
Thanks neuron2.
1. Copied the contents of DGDecNV2042 to the plugins folder of Avisynth and got the following error message:
DGSource : Cannot open index file!
2. Does DGDecNV2042 work with ATI graphics card? If not. what are the alternatives?
3. Should the cycle parameter in tdecimate be set to 24 instead of 23?
Many thanks and best regards.
Guest
13th September 2012, 13:39
1. Copied the contents of DGDecNV2042 to the plugins folder of Avisynth and got the following error message:
DGSource : Cannot open index file! Well, did you make an index file? Did you read the quick start guide and learn how everything works? Anyway, don't bother with that now because you need an nVidia card.
2. Does DGDecNV2042 work with ATI graphics card? If not. what are the alternatives? Of course it won't work with ATI! You have to start reading things like documentation, tool websites, and existing threads. The alternative as I said is to use a different source filter. Maybe DirectShowSource() or FFMPEGSource().
3. Should the cycle parameter in tdecimate be set to 24 instead of 23? You said the problem was to remove one in 23, so the cycle is 23.
Keiyakusha
13th September 2012, 21:14
Have you considered to interpolate every 23th frame instead of removing it?
Benefits: no need to mess with audio, framerate will remain standard
But you have to ask someone else to provide exact script for that.
poisondeathray
13th September 2012, 22:11
Have you considered to interpolate every 23th frame instead of removing it?
Benefits: no need to mess with audio, framerate will remain standard
just to add:
negatives: possible interpoloation artifacts (edge morphing).
recommended a frame accurate source filter for this type of work (otherwise frames get mixed up and interpolated incorrectedly)
You can encoded to an I-frame lossless intermedate with directshowsource if you have to
But you have to ask someone else to provide exact script for that.
If it's constant then you can use applyevery.dll with mflowinter from mvtools2
e.g these are duplicates:
5,6
29,30
53,54
(This code was from gavino's help on another project)
sup = MSuper()
bv = MAnalyse(sup, isb=true, delta=2)
fv = MAnalyse(sup, isb=false, delta=2)
interpolated = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0)
replace = interpolated.SelectEvery(24, 6) # replacement frames
DeleteEvery(24, 6) # delete bad frames
InterleaveEvery(replace, 24, 6) # replace deleted frames
So the offset is 6 (1st dupe occurs there), and it's every 24 (that's why 24, 6 is used)
If the duplicates are not in a fixed pattern, you can use filldrops() or related functions (there are a few modified ones floating around for mvtools2), which calculate based on dupe detection (you can adjust the threshold value and check it with the debug mode)
mariner
16th September 2012, 08:49
Thanks neuron2. Few more questions:
Video
1. The pattern seems to be 23 distinct frames followoed by 1 repeated frame, so tdecimate(cycle=24,cycleR=1)?
2. What parameters do you suggest for re-encoding the decimated video, for 22GB target file size to fit in a BD-25?
Here's the mediainfo:
General
ID : 0 (0x0)
Complete name : D:\BDMV\STREAM\00007.m2ts
Format : BDAV
Format/Info : Blu-ray Video
File size : 19.5 GiB
Duration : 1h 34mn
Overall bit rate mode : Variable
Overall bit rate : 29.5 Mbps
Maximum Overall bit rate : 48.0 Mbps
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Format settings, GOP : M=3, N=12
Codec ID : 27
Duration : 1h 34mn
Bit rate mode : Variable
Maximum bit rate : 35.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
3. It's not clear how the -25ms delay helps when the decimated clip is ~4% (4 minutes) shorter. Or is the audio sync issue dealt with by the sync_audio=true parameter?
4. The AC3 audio is 6 channels, but can't seem to get nicac3source to output more than 2 channels. Both aud=nicac3source("mastiff.ac3",6) and ("mastiff.ac3") result in error.
5. TimeStretch(tempo = 100*25.0/(24000.0/1001.0)) seems to work on the sample. Need to test with the full clip.
6. Need help with audio source filters that work on the m2ts clip instead of demuxed audio files. Not having much success with FFaudiosource and DirectShowSource.
The clip has two 6 channel audio streams : 640kbps TrueHD/AC3 and 448kbps AC3.
Audio #1
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : TrueHD / AC-3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Muxing mode : Stream extension
Codec ID : 131
Duration : 1h 30mn
Bit rate mode : Variable / Constant
Bit rate : Unknown / 640 Kbps
Maximum bit rate : 4 947 Kbps / 640 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Audio #2
ID : 4353 (0x1101)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 1h 30mn
Bit rate mode : Constant
Bit rate : 448 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 291 MiB (1%)
Many thanks and best regards.
Guest
16th September 2012, 13:56
Yes, those tdecimate values would be correct values for 23 frames followed by one duplicate.
Can't help with your encoding question, I rarely do such things.
Audio delay affects the starting offset of the audio so it doesn't matter if frames are removed. Note that the first frame cannot be removed because it cannot be a duplicate. The tdecimate() by itself will not change the audio sync. That would only be an issue if you did an AssumeFPS() to get back to a standard frame rate.
I suggest reposting your other audio questions in appropriate threads/forums. I don't know the answers to them.
Didée
16th September 2012, 17:53
Did anyone realize that always 2 frames after the duplicate frame there is one frame missing? - It's a "A B C D D E,,G H" sequence. It almost seems like some form of IVTC has been performed, but the decimator has dropped out of phase, hence has removed good nearby frames instead of the IVTC-duplicates.
Guest
16th September 2012, 23:44
Did anyone realize that always 2 frames after the duplicate frame there is one frame missing? Nope, didn't notice that. I believe you though.
Didée
17th September 2012, 13:56
In the given sample it's not exactly obvious to see, but it can be tracked. In the very beginning there is 12fps animation. Stepping single frames, one can see that every 24 frames there is one instance with 3 frames of one motion state, followed by 1 frame of one motion state. In the long running dog sequence its hard to see in motion, but the missing frame can be tracked by the grass at the bottom, there's always a skip one frame after the dup. It would be more obvious in the end scene, scrolling mountains at 24fps - but the scene is too short to notice it easily.
In any case, just deleting the dup frame and forcing the 23fps to 24fps again will not result in fluid motion. (Well, whatever "fluid" may mean in case of animation.) After deleting the dups, you still have the skips ...
What would be needed to be done is: shift the frame right of the dup to the left, and place something interpolated into its position - either a simple blending, or a motion interpolation. Motion interpolation is somewhat problemtic with animation, though.
mariner
18th September 2012, 13:38
Greetings Keiyakusha, poisondeathray and Didée.
Many thanks for all the suggestions, and in particular Didée's brilliant observation.
Didée is right, of course. The attached screen cap of 8 frame running dog sequence shows clearly the repeated (blue) and removed (red) frames.
Re-encoding seems to be in order. Detailed instructions appreciated.
Many thanks and best regards.
Didée
19th September 2012, 23:12
# LoadPlugin("MVTools2.dll")
dgsource("mastiff.dgi")
o = last
o4 = o.pointresize(width+16,height+16,-4,-4,width+16,height+16)
o8 = o.pointresize(width+16,height+16,-8,-8,width+16,height+16)
o12 = o.pointresize(width+16,height+16,-12,-12,width+16,height+16)
d2p = mt_lutxy(o,o.selectevery(1,-1),"x y - abs 128 *").greyscale()
dup = mt_lutf(d2p,d2p,mode="avg",yexpr="x").mt_lut("x 2 < 255 0 ?")
skip = dup.selectevery(1,-1)
sup = o.msuper(pel=1)
bv = sup.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv = sup.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter = o.mblockfps(sup,bv,fv,num=0,mode=3).selectodd()
sup4 = o4.msuper(pel=1)
bv4 = sup4.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv4 = sup4.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter4 = o4.mblockfps(sup4,bv4,fv4,num=0,mode=3).selectodd().crop(4,4,-12,-12,true)
sup8 = o8.msuper(pel=1)
bv8 = sup8.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv8 = sup8.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter8 = o8.mblockfps(sup8,bv8,fv8,num=0,mode=3).selectodd().crop(8,8,-8,-8,true)
sup12 = o12.msuper(pel=1)
bv12 = sup12.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv12 = sup12.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter12 = o12.mblockfps(sup12,bv12,fv12,num=0,mode=3).selectodd().crop(12,12,-4,-4,true)
inter = merge(merge(inter12,inter8),merge(inter4,inter))
conditionalfilter(dup,o,o.selectevery(1,1),"averageluma","<","2")
conditionalfilter(skip,last,inter,"averageluma","<","2")
return(last)
Try and see if/how it works out.
If you watch the single frames, you'll certainly find that there are errors in the motion-interpolated frames. In particular in the running dog scene, motioninterpolation is not very successful. In the mountains scene, OTOH, the interpolation is fairly okay.
However, do not only judge by the quality of single frames. Make some shorter encoding tests, and watch the result in motion. Lots of errors that seem obvious in a freeze frame, may go by almost un-noticed during normal playback. Important is that there is something that represents the expected motion state.
_____
Technical note:
The script implements averaging of 4 off-setted MBlockFPS. That's not fast (but no drama here because it is used only for 1 frame out of 24 anyway), but avoids the swirling-artifacts of MFlowFPS, and reduces the blocking of normal MBlockFPS. (IF it occurs, it's split up into micro-blocking, with the result appearing more "blurry", rather than "blocky".)
mariner
21st September 2012, 09:58
Thanks for the script, Didée.
1. Can you suggest another source filter (must it be frame accurate?) for my non NV system?
2. Can you help with getting audio to work? This script result in error.
a=FFaudioSource("mastiff.m2ts",track=2)
Many thanks and best regards.
Edit:
1. Audio track 2 playable by enabling raw codec in FFdshow audio decoder.
2. Audio track 1 not playable, error message: "FFaudioSource : audio stream not seekable."
Guest
21st September 2012, 13:24
This script result in error. Tell us what the error was.
mariner
24th September 2012, 04:48
Tell us what the error was.
How do I get audio track 1 to play?
Guest
24th September 2012, 13:35
Please provide the entire script.
Also, I don't know if ffaudiosource() may have a problem with TrueHD audio, but if so, you can convert that to something usable with EAC3TO.
mariner
24th September 2012, 17:09
Please provide the entire script.
Also, I don't know if ffaudiosource() may have a problem with TrueHD audio, but if so, you can convert that to something usable with EAC3TO.
Greetings neuron2.
This scruipt works fro track=2, not track=1.
v=DirectShowSource("dog1.m2ts",audio=false)
a=FFaudioSource("dog1.m2ts",track=2)
audiodub(v,a)
mariner
24th September 2012, 17:12
# LoadPlugin("MVTools2.dll")
dgsource("mastiff.dgi")
o = last
o4 = o.pointresize(width+16,height+16,-4,-4,width+16,height+16)
o8 = o.pointresize(width+16,height+16,-8,-8,width+16,height+16)
o12 = o.pointresize(width+16,height+16,-12,-12,width+16,height+16)
d2p = mt_lutxy(o,o.selectevery(1,-1),"x y - abs 128 *").greyscale()
dup = mt_lutf(d2p,d2p,mode="avg",yexpr="x").mt_lut("x 2 < 255 0 ?")
skip = dup.selectevery(1,-1)
sup = o.msuper(pel=1)
bv = sup.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv = sup.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter = o.mblockfps(sup,bv,fv,num=0,mode=3).selectodd()
sup4 = o4.msuper(pel=1)
bv4 = sup4.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv4 = sup4.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter4 = o4.mblockfps(sup4,bv4,fv4,num=0,mode=3).selectodd().crop(4,4,-12,-12,true)
sup8 = o8.msuper(pel=1)
bv8 = sup8.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv8 = sup8.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter8 = o8.mblockfps(sup8,bv8,fv8,num=0,mode=3).selectodd().crop(8,8,-8,-8,true)
sup12 = o12.msuper(pel=1)
bv12 = sup12.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv12 = sup12.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter12 = o12.mblockfps(sup12,bv12,fv12,num=0,mode=3).selectodd().crop(12,12,-4,-4,true)
inter = merge(merge(inter12,inter8),merge(inter4,inter))
conditionalfilter(dup,o,o.selectevery(1,1),"averageluma","<","2")
conditionalfilter(skip,last,inter,"averageluma","<","2")
return(last)
Try and see if/how it works out.
If you watch the single frames, you'll certainly find that there are errors in the motion-interpolated frames. In particular in the running dog scene, motioninterpolation is not very successful. In the mountains scene, OTOH, the interpolation is fairly okay.
However, do not only judge by the quality of single frames. Make some shorter encoding tests, and watch the result in motion. Lots of errors that seem obvious in a freeze frame, may go by almost un-noticed during normal playback. Important is that there is something that represents the expected motion state.
_____
Technical note:
The script implements averaging of 4 off-setted MBlockFPS. That's not fast (but no drama here because it is used only for 1 frame out of 24 anyway), but avoids the swirling-artifacts of MFlowFPS, and reduces the blocking of normal MBlockFPS. (IF it occurs, it's split up into micro-blocking, with the result appearing more "blurry", rather than "blocky".)
Thanks Didee.
Did not get too far with this script:
First, "Script error: there is no function named "mt-lutxy".
After loading "mt_masktools-25.dll"(is "mt_masktools-26.dll" needed?),
this error "MAnalyse: cannot load FFTW3.dll" appeared.
How should I proceed?
LoadPlugin("E:\data\tibetdog\didee\MVTools2.dll")
LoadPlugin("E:\data\tibetdog\didee\mt_masktools-25.dll")
DirectShowSource("dog1.m2ts",audio=false)
o = last
o4 = o.pointresize(width+16,height+16,-4,-4,width+16,height+16)
o8 = o.pointresize(width+16,height+16,-8,-8,width+16,height+16)
o12 = o.pointresize(width+16,height+16,-12,-12,width+16,height+16)
d2p = mt_lutxy(o,o.selectevery(1,-1),"x y - abs 128 *").greyscale()
dup = mt_lutf(d2p,d2p,mode="avg",yexpr="x").mt_lut("x 2 < 255 0 ?")
skip = dup.selectevery(1,-1)
sup = o.msuper(pel=1)
bv = sup.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv = sup.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter = o.mblockfps(sup,bv,fv,num=0,mode=3).selectodd()
sup4 = o4.msuper(pel=1)
bv4 = sup4.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv4 = sup4.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter4 = o4.mblockfps(sup4,bv4,fv4,num=0,mode=3).selectodd().crop(4,4,-12,-12,true)
sup8 = o8.msuper(pel=1)
bv8 = sup8.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv8 = sup8.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter8 = o8.mblockfps(sup8,bv8,fv8,num=0,mode=3).selectodd().crop(8,8,-8,-8,true)
sup12 = o12.msuper(pel=1)
bv12 = sup12.manalyse(isb=true, blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
fv12 = sup12.manalyse(isb=false,blksize=16,overlap=0,search=5,searchparam=6,DCT=5)
inter12 = o12.mblockfps(sup12,bv12,fv12,num=0,mode=3).selectodd().crop(12,12,-4,-4,true)
inter = merge(merge(inter12,inter8),merge(inter4,inter))
Guest
24th September 2012, 17:14
This scruipt works for track=2, not track=1. If it's like mastiff.m2ts, then track 1 is TrueHD. As I said, convert it to something usable with EAC3TO.
Didée
24th September 2012, 17:40
masktools-25.dll is correct if you use Avisynth v2.5.x. masktools-26.dll is correct if you use Avisynth v2.6.x
Oops, I wasn't aware that MVTools requires the fftw3 library. Seems it is required when a DCT mode other than zero is used.
You grab the fftw3 DLL from here (http://avisynth.org/warpenterprises/#fftw3), and unpack the DLL into ...
... \windows\system32 - IF you run 32-bit Windows, or into
... \windows\syswow64 - IF you run 64-bit Windows.
mariner
24th September 2012, 18:06
If it's like mastiff.m2ts, then track 1 is TrueHD. As I said, convert it to something usable with EAC3TO.
Good to get confirmation that FFaudioSource does not load TrueHD track. Thanks neuron2.
Guest
24th September 2012, 18:10
I'm not confirming that! I'm saying if it is the case, and your experience suggests it, then you can work around it by transcoding it with EAC3TO.
mariner
24th September 2012, 18:19
masktools-25.dll is correct if you use Avisynth v2.5.x. masktools-26.dll is correct if you use Avisynth v2.6.x
Oops, I wasn't aware that MVTools requires the fftw3 library. Seems it is required when a DCT mode other than zero is used.
You grab the fftw3 DLL from here (http://avisynth.org/warpenterprises/#fftw3), and unpack the DLL into ...
... \windows\system32 - IF you run 32-bit Windows, or into
... \windows\syswow64 - IF you run 64-bit Windows.
Thanks Didée.
1. The inserted frame, especially the dog, looks blurry.
2. Can't get smooth motion during playback. My Q8400 system had to pause to generate the new frame. Will do a re-encode to test.
3. What would you suggest using, FFVideoSource or DSS2?
4. How about using this 2-pass script to encode the 94min video? Suggestions for tweaking?
x264 --bitrate 26000 --preset veryslow --tune animation --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o 00007.264 00007.avs
x264 --bitrate 26000 --preset veryslow --tune animation --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o 00007.264 00007.avs
5. Is --fps 24000/1001 needed?
6. x264 displays the number of frames encoded, but not of the original file. How does one get that info or get x264 to display that?
Many thanks and best regards.
mariner
4th October 2012, 13:37
Thanks Didée.
3. What would you suggest using, FFVideoSource or DSS2?
4. How about using this 2-pass script to encode the 94min video? Suggestions for tweaking?
x264 --bitrate 26000 --preset veryslow --tune animation --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o 00007.264 00007.avs
x264 --bitrate 26000 --preset veryslow --tune animation --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o 00007.264 00007.avs
5. Is --fps 24000/1001 needed?
6. x264 displays the number of frames encoded, but not of the original file. How does one get that info or get x264 to display that?
Many thanks and best regards.
Greetings Didee.
1. Did you get a chance to take a look at these questions? Would appreciate some advice here.
2. Could you kindly modify the algorithm to accommodate this sequence shown in cut.m2ts:
1,1a, 2,2a, 3,3a, ....11,11a,11b, 12
13,13a, 14,14a, 15,15a,......23,23a,23b, 24
The current routine seems to remove frame 11a and insert a new frame between frames 11b and 12, while it should actually be removing 11b and insert one between 12 and 13.
It would be better still if frame 12 can be repeated for this type of sequence.
3. x264 log reports different number of frames encoded when different source filters are used:
DS=DSS2+1=FFVS+2
Why?
4. DS also seems to exhibit some strange out of sequence behavior : frame 13 is replaced by 11, in 2 out of 3 sequences (see cut_ds.m2ts). What's peculiar is this seems to happen during encoding, but not during playback of original file.
How did this happen?
Many thanks and best regards.
cut.m2ts (http://www2.zshare.ma/fbbp7noio4sf)
cut_ds.m2ts (http://www2.zshare.ma/lpqyegx72oc8)
Didée
5th October 2012, 09:51
I hear you. However, it's a tricky problem.
The filterchain is laid out for 24fps sections. That's the "easy" part, and that's where motion stutter is mostly noticeable. (Panning scenes in particular).
For 12fps sections, doing the "correct" thing is a different ballgame. Instead of looking for single dups, it would be required to look for triples, and the interpolation part should be omitted completely.
I hoped to eventually get by with the slightly suboptimal handling of 12fps sections.:) - Getting everything together is difficult. Doing extended dup detection via script is cumbersome, and it is coarse. (E.g.: can't tell if some small frame differences are due to small artifacts [is-a-dup], or due to small mouth-movement [is-NOT-a-dup].) Filters like TDecimate have much more sophisticated evaluation methods for dup detection ... but are laid out to just do the decimation, and won't allow nicely to be used for frame-shuffling like it is required here.
The easiest thing would be to set up one routine for 12fps and one for 24fps, then let the user splice everything together manually.
A trim()+trim()+trim()+trim() orgy, that is. :)
Perhaps I can have another look at it this weekend ... but no guarantee.
mariner
6th October 2012, 15:37
I hear you. However, it's a tricky problem.
The filterchain is laid out for 24fps sections. That's the "easy" part, and that's where motion stutter is mostly noticeable. (Panning scenes in particular).
For 12fps sections, doing the "correct" thing is a different ballgame. Instead of looking for single dups, it would be required to look for triples, and the interpolation part should be omitted completely.
I hoped to eventually get by with the slightly suboptimal handling of 12fps sections.:) - Getting everything together is difficult. Doing extended dup detection via script is cumbersome, and it is coarse. (E.g.: can't tell if some small frame differences are due to small artifacts [is-a-dup], or due to small mouth-movement [is-NOT-a-dup].) Filters like TDecimate have much more sophisticated evaluation methods for dup detection ... but are laid out to just do the decimation, and won't allow nicely to be used for frame-shuffling like it is required here.
The easiest thing would be to set up one routine for 12fps and one for 24fps, then let the user splice everything together manually.
A trim()+trim()+trim()+trim() orgy, that is. :)
Perhaps I can have another look at it this weekend ... but no guarantee.
Greetings and many thanks Didee.
You're right about how panning scenes killed the film.
I've enclosed examples of these that have not been effectively handled by the algorithm,
and hope perhaps you can make some improvements as well.
Best regards.
pan1.m2ts (http://www2.zshare.ma/pongphioika2)
pan2.m2ts
(http://www2.zshare.ma/i8lan920tufq)
Didée
8th October 2012, 10:39
Sorry, but ATM I can do nothing. My PC is knocked-out, the power supply blew up on Saturday. Don't have suited sparepart, and RMA will take (too many) days ...
mariner
9th October 2012, 12:45
Sorry to hear that, Didée. Please take your time.
Did you use neuron2's source filter to test the clips? If so can you kindly let me know the number of frames encoded reported by x264 to be used as a reference?
Which source filter would you suggest? DirectShowSource, FFvideoSource or DSS2? Or something else?
Many thanks and best regards.
Didée
15th October 2012, 13:40
Here we go again.
In the first set of samples, there was an offset of 2 frames between false-dup and missing-frame. In this second set, there is only 1 frame offset.
The script was made for the 1st case, and of course won't work correctly in the 2nd case.
What ~seems~ to have happened to the source is this: there was a telecined stream at either 30p or 60p stage, and the decimation was not done with a "smart" decimator, but rather by using a static/fixed removal pattern. Which of course will fail when the source's telecine pattern isn't 100% constant.
This would a) fully explain the issue of dups and missing frames, but it als raises b) a bigger problem: Though the samples are only showing cases of 1 or 2 frames offset, it is to expect that there could be ANY offset, from zero up to 23 frames, between the dups and the missing-frames. And that's a problem indeed. This means you cannot just look for duplicates and conclude the missing frames from the dups' positions. Instead, you have to identify the positions of missing frames by themselves. Yeeha! Reckognizing dup-frames is relatively easy, but reckognizing missing frames is very difficult.
I fear there will be no magic-script-solution for this problem. Well, I have done something similar in the past, but it was for "natural" content instead of Anime (natural content is much easier in respect to skip detection), and the deal was only about short 5-frames-intervals (from 30>25 decimation) instead of 24-frames intervals like here.
(Reckognition of missing frames in any case is lousy and whacky, so you need confirmation of pattern-distanced neighbors to help making decisions. Having to use -10-5+5+10 frames (20 frame window) is bad enough, but using -48-24+24+48 neighbors (100 frame window) smells like the whole shebang going BOOM.
It seems I'm giving up at this point.
If anybody has better ideas: speak loud.
mariner
22nd October 2012, 15:09
Greetings Didée. Many thanks for taking a detailed look at the clips.
I think you're right. While the flying eagle sequence in pan1.m2ts follows the 2 frame offset pattern, the beginning of the clip and pan2.m2ts does not reveal any clue. 1 frame offset seems like the best fit.
Did you get a chance to look at cut.m2ts? It seems using the DirectShowSource filter with you script results in out of sequence behavior. Any explanation?
Many thanks and best regards.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.