Attachment "field-muxing" is a field-muxed YV12 video, i.e one field is video1 and the other field is video2.
Attachment "field-demuxing" are various attempts to recover the 2 videos, either resulting in blends or deinterlacing artifacts.
Any suggestions how to recover the 2 videos cleanly? Thanks.
+ Reply to Thread
Results 1 to 23 of 23
-
-
even fields are contaminated by odd fields, I do not see a simple solution
edit: it appears to me that only the red ball appears in the even fields, maybe a masking with a subtract(even, odd) limited to that region may help, no idea how to implement itLast edited by lollo; 26th Mar 2023 at 16:07.
-
Thanks. There seems to be no easy solution. Just scratching my head where the root cause of the problem is:
- the source(s)
- the "field-muxing" of the YV12 videos
- the YV12 AVC encoding/compression
- the deinterlacers (apparently they behave differently)
- alltogether .... -
How has the file "field-muxing.mp4" been created?
The "sources" for even and odd fields are completely different, so how have them been separated into fields and mixed together? -
The chroma of the two fields has been partially blended together. Here's the two fields with the chroma unblended.
[Attachment 69999 - Click to enlarge]
Code:LWLibavVideoSource("field-muxing.mp4", cache=false, prefer_hw=2) SeparateFields() v1 = SelectEven() v2 = SelectOdd() c1 = MergeChroma(v1, Overlay(v1, v2, mode="subtract", opacity=0.33)) c2 = MergeChroma(v2, Overlay(v2, v1, mode="subtract", opacity=0.33)) # c1 and c2 are the cleaned fields # enable one of the following lines to see a single field, double height #return(c1.nnedi3(dh=true)) #return(c2.nnedi3(dh=true)) # otherwise, show them stacked StackVertical(c1, c2) AssumeFrameBased()
Last edited by jagabo; 26th Mar 2023 at 18:22.
-
Out of curiosity: How do such files come to be? I mean, is someone creating such stuff by hand or is there some camera or similar creating such content?
users currently on my ignore list: deadrats, Stears555, marcorocchini -
Probably mishandling of interlaced YV12 video. But this one is different than the usual 50:50 blend of the chroma. It only has a ~33 percent blend. I don't know how that came to be.
-
There exist video surveillance systems using this technology to double the number of cameras and saving storage space. Probably these systems are shipped with their proprietary decoding software, I don't know.
Out of curiosity I made an attempt to emulate such a system using the script:
Code:v1=AVISource("video1.avi") #4:2:2 interlaced YUY2 source1 v1=v1.assumeTFF().converttoYV12(interlaced=true) #converting to YV12 v2=AVISource("video2.avi") #4:2:2 interlaced YUY2 source2 v2=v2.assumeTFF().converttoYV12(interlaced=true) #converting to YV12 f1e=v1.separatefields().selecteven() #even field of video1 f2o=v2.separatefields().selectodd() #odd field of video2 frame=interleave(f1e,f2o).weave() #reinterlace field1 (top) of video1 and field 2 (bottom) of video2 return frame
Edit:
No idea what went wrong with the chroma blending yesterday.
Just did it again and it seems to be ok now regarding the chroma blending:Last edited by Sharc; 27th Mar 2023 at 03:45.
-
The new files are ok, no contamination. What happened in your first example causing the (partial) chroma contamination is then unknow. Just don't do it again
In any case, master jagabo was able to repair the problem (looking to his script, the "subtract" idea we had yesterday was not too bad) -
Good to know...
-
@Sharc,
Can you tell us,
Which NLE was it? (might be good for some to avoid when having to deal with these kinds of footage).
Scott -
In Shotcut I have to set the video properties of the source explicitly to interlaced, TFF as it defaults to progressive. It seems however to have little to nil effect on the chroma blending unless I enable the 'Color Grading' filter as well.
(Btw. I guess that the color grading filter makes a YUV to RGB conversion. Shotcut works in YUV colorspace AFAIK, unless a filter requests the conversion to RGB).
Some more tests pending .....Last edited by Sharc; 28th Mar 2023 at 02:22.
-
Here some results from chroma blending/crosstalk/leakage tests of YV12 interlaced AVC encodes using different encoding tools.
The source 'source_422i.avi' for the tests is interlaced YUV 4:2:2, one field RED the other field GREEN, which was converted to YV12 by the script
Code:LWLibavVideoSource("source_422i.avi") ConvertToYV12(interlaced=true)
The attached file 'YV12 encodes.avi' shows the result of the encodes. Left side is the AVC encoded YV12 frame, right side are the separated fields.
Surprisingly, only the commandline x264 and ffmpeg libx264 encodes returned clean separated fields in the original colors (cases 1 and 2).
The NLE Shotcut (case 3) darkened the colors, and the RED field is actually out of RGB gamut. Enabling the 'Color Grading' filter in Shotcut (case 3a) gave fields colors closer to the original RED and GREEN fields, but with a faint horizontal line pattern. The NLE Kdenlive (case 4) is identical to the Shotcut case 3a.
It seems to me like the NLEs added their own magic, or I did something totally wrong ......... -
Thanks for the interesting results.
I ignore if you did something wrong, but anyhow I always try to avoid a GUI or a NLE for encoding and simply use a ffmpeg command line -
Vegas should be ok. The line artifacts are likely because you forgot to interpret the video as "interlaced", so it performs the chroma upsampling (internally vegas works in RGB) and then to 4:2:0 as progressive chroma sampling instead of interlaced.
Shotcut and Kdenlive do not have proper interlaced support the last time I checked
EDIT: yes - vegas is ok when you interpret "source_422i.avi" as "interlaced", and the timeline and export settings match. (It comes in interpreted as progressive and you need to manually assign)Last edited by poisondeathray; 5th Apr 2023 at 08:57.
-
Thanks. It's just too bad. It seems still to be the case.
This is what I am getting then for the 2 fields. No line artefacts, but the the separated fields are far from the original RED and GREEN ....
[Attachment 70191 - Click to enlarge] -
Thank you for the hints and for the sample.
I did all this, but the problem seems to be my Vegas Movie Studio version 16 which has its limitations and cannot properly convert the 4:2:2 interlaced source to 4:2:0 AVC interlaced.
I have to convert 4:2:2 to 4:2:0 with an avisynth script (ConvertToYV12(interlaced=true)), and because Vegas cannot read Avisynth scripts I use AVFS to produce a virtual .avi file for Vegas (same applies for Shotcut and Kdenlive btw.). The result is that the colors (fields) are eventually about right but with the scanline artefacts, see post#18.
My Vegas Movie Studio can do the conversion without the AVFS workaround using its mpeg2 encoder. The outcome is correct, but mpeg2 instead of AVC.
Anyway, a simple script + commandline (x264 or ffmpeg) does the job perfectly.Last edited by Sharc; 6th Apr 2023 at 01:49.
Similar Threads
-
Muxing Videos with Different Field Orders
By koberulz in forum Newbie / General discussionsReplies: 8Last Post: 23rd Aug 2021, 22:09 -
need help - 3D muxing from 2-field MKV rips to .TS
By oleus23 in forum Video ConversionReplies: 2Last Post: 14th May 2021, 12:37 -
Field-blended video with messed up field order
By bruno321 in forum RestorationReplies: 1Last Post: 23rd Feb 2021, 10:34 -
Hauppauge USB-Live 2: Top field or bottom field?
By billybatts in forum Capturing and VCRReplies: 3Last Post: 9th May 2020, 04:57 -
RipBot Demuxing Error
By Predator1 in forum Blu-ray RippingReplies: 0Last Post: 24th Aug 2018, 10:26