actionman133
8th January 2006, 10:13
Hi,
Just finished with a filter that some people might find useful. It's a filter that allows YV12 video to be converted to YUY2 (to meet input requirements for a filter like ConvertFPS, or a program like Premiere Pro), and then back to YV12 without loss. It works by storing YV12 chroma in YUY2 and filling the remaining chroma with a BlankClip. It then converts back by cropping the BlankClip out and restoring the original chroma.Function YV12toYUY2 (clip Last) {
Y = Tweak (sat = 0, coring = false).ConvertToYUY2 ()
U = StackVertical (UtoY (), BlankClip (UtoY ())).ConvertToYUY2 ()
V = StackVertical (VtoY (), BlankClip (VtoY ())).ConvertToYUY2 ()
Return YtoUV (U, V, Y)
}
Function YUY2toYV12 (clip Last) {
Y = Tweak (sat = 0, coring = false).ConvertToYV12 ()
U = UtoY ().Crop (0, 0, Y.Width / 2, Y.Height / 2).ConvertToYV12 ()
V = VtoY ().Crop (0, 0, Y.Width / 2, Y.Height / 2).ConvertToYV12 ()
Return YtoUV (U, V, Y)
}
If you edit in Premiere Pro, you would edit as you like without using these functions. Then, when you come to your final rendering, you add this line to the end of your script and save the movie with a lossless YUY2 codec (such as HuffYUV). Then open the lossless AVI with another script and use YUY2toYV12 and you'll get the original video back losslessly. Within AVISynth you could use it like this:#YV12 source
YV12toYUY2 ()
ConvertFPS (25)
YUY2toYV12 ()
You can test losslessness for yourself with a single line... Subtract (clip, clip.YV12toYUY2 ().YUY2toYV12 ())Just putting it out there for anyone who might like it...
Just finished with a filter that some people might find useful. It's a filter that allows YV12 video to be converted to YUY2 (to meet input requirements for a filter like ConvertFPS, or a program like Premiere Pro), and then back to YV12 without loss. It works by storing YV12 chroma in YUY2 and filling the remaining chroma with a BlankClip. It then converts back by cropping the BlankClip out and restoring the original chroma.Function YV12toYUY2 (clip Last) {
Y = Tweak (sat = 0, coring = false).ConvertToYUY2 ()
U = StackVertical (UtoY (), BlankClip (UtoY ())).ConvertToYUY2 ()
V = StackVertical (VtoY (), BlankClip (VtoY ())).ConvertToYUY2 ()
Return YtoUV (U, V, Y)
}
Function YUY2toYV12 (clip Last) {
Y = Tweak (sat = 0, coring = false).ConvertToYV12 ()
U = UtoY ().Crop (0, 0, Y.Width / 2, Y.Height / 2).ConvertToYV12 ()
V = VtoY ().Crop (0, 0, Y.Width / 2, Y.Height / 2).ConvertToYV12 ()
Return YtoUV (U, V, Y)
}
If you edit in Premiere Pro, you would edit as you like without using these functions. Then, when you come to your final rendering, you add this line to the end of your script and save the movie with a lossless YUY2 codec (such as HuffYUV). Then open the lossless AVI with another script and use YUY2toYV12 and you'll get the original video back losslessly. Within AVISynth you could use it like this:#YV12 source
YV12toYUY2 ()
ConvertFPS (25)
YUY2toYV12 ()
You can test losslessness for yourself with a single line... Subtract (clip, clip.YV12toYUY2 ().YUY2toYV12 ())Just putting it out there for anyone who might like it...