Log in

View Full Version : Problems decoding AVCHD recordings


JK1974
19th October 2021, 13:24
Hi,

after some years of delay, I started editing my AVCHD recordings made back then with a Canon HF100 HD.
I want to use AVISynth and VirtualDubMod2īs batch processing for deshaking and maybe denoising of the clips and then finally do the editing with DaVinci Resolve.

Unfortunately, I just learned that there seem to be decoding errors: I get heavy flickering in orange and red areas. It looks to me that these are caused by faulty input filters.

Attachment 1 shows what I get when I load the MTS file into DaVinci Resolve, export it as Apple ProRes and open it in VirtualDubMod2 - this seems to be a correct result (judging the deinterlaced playback preview).
VLC also seem to be able to playback the original file without flickering.
https://i.postimg.cc/SJ1pvPGC/1-Da-Vinci-Resolve.png

Attachment 2 shows what I get when I

open it in VirtualDubMod2 directly
open it in VirtualDubMod2 using FFMPEGSource2
open it in VirtualDubMod2 using LWLibavVideoSource
convert the original file with FFMPEG using "ffmpeg -i 00186.mts -c:v prores_ks -profile:v 3 -vendor apl0 -bits_per_mb 8000 -pix_fmt yuv422p10le proRes422_output.mov"

Here, at least the red color plane seems to be shifted.
https://i.postimg.cc/k2Vd3yjZ/2-FFMPEG.png

Am I missing any setting on the FFMPEG conversion/VirtualDubMod2/AVISynth input filters or is there still a bug?
Are there any alternative input filters besides of DirectShowSource (which also does not seem to work reliable) for AVISynth, maybe based on the VLC library?

Thanks a lot for any hints, with kind regards!

johnmeyer
19th October 2021, 16:19
Are you able to play these same files using a media player? Can you transcode them, using ffmpeg, to something that will play smoothly?

I realize you don't want to add transcoding to the workflow, but both these tests can help determine where the problem may lie. You want to rule out your computer (not enough CPU), and you want to determine if there is something odd about the AVCHD files. I think your camera was one of the first that could capture 60 fps progressive, and I have a vague recollection that people had problems editing them, although I think most of those problems were caused by the hardware and software not yet being ready for unpacking 1920x1080 at 60 full frames each second.

[edit]I just took a quick look, and I guess it was only 30 fps.

JK1974
19th October 2021, 18:56
Hi johnmeyer,

it is not about judder, it is about flickering.
The standard is AVCHD PAL and thus 1080i50 - I forgot to mention this.

Both is playing fluently using Yadif deinterlacing in VLC and VirtualDub, but you get this heaving color flickering in the red areas.
Please have a look at the images and scale them so that you can clearly see the interlace lines - and compare them next to each other. You will see that the color seems to be shifted (maybe by 1 pixel vertically?) in the defective output.

Like written before:
OK
- Playing back in Davinci Resolve is ok
- Exporting it from Davinci Resolve e.g. in Apple DXnHD or GrassValley and playing back the result in VirtualDub2 with Yadif is ok
- Playing it back in VLC with Yadif is ok

Wrong
- Playing back the original file directly with VirtualDubMod2 with Yadif is not ok
- Playing back the file opened with any AVISynth input filter (like FFMPEGSource, LWLibavVideoSource, DirectShowSource etc.) is not ok (and thus also not any encoding result after having opened it that way)
- Converting the original source file it with FFMPEG also does not seem to work (and ffmpeg libraries are often used in input filters)...

So I think that I figured out that it is the input filter or itīs configuration that causes the problems.

The only think that I donīt understand: The file also seems to be deinterlaced correctly with the Windows Media Player which uses DirectShow.
But, just like written and tested after my initial post, my tests with DirectShowSource and DSS2 as AviSynth filters also were not successful.

I think that it *might* be related to the pixel format and there could be some internal conversion going on (even with FFMPEG), but at this point, I donīt know where and how I would be able to adjust it.

Since the original recording is private and shows some persons, I might have to record a new test file to be able to share it to everyone...

(BTW: The whole editing canīt be done without additional transcoding, but indeed, I want to avoid it as good as possible. Furthermore, I am not aware that Davinci Resolve would allow me to do a batch conversion of all clips prior to the usage in VirtualDub.
The current workflow: AVISynth -> VirtualDub Deshaker -> AppleProRes -> Davinci Resolve -> x264 with Blu-ray settings -> MKVToolnix)

poisondeathray
19th October 2021, 19:10
Your attachments might take a while to get approved. People often use 3rd party image hosts such as postimages.org or similar sites if they want a faster reply

I'm going to make a bunch of educated guesses based on your description

The shifting of colors is likely Rec601 vs. 709 mismatch. How the YUV video is converted to RGB for preview. Vdub/vdub2 uses rec601 by default, which is usually incorrect for "HD" sources .

Not sure what the flickering is by the description (can't see the images, and you can't see flicker on a single image anyways....), but vdub/vdub2 also upsamples the chroma and convert to RGB in a progressive fashion, so if camera recording was interlaced, you will get chroma artifacts in the preview

In order to use a RGB filter (such as deshaker) when you have interlaced input, you would normally double rate deinterlace first to 50p then use progressive conversion to RGB , also specifying 709 matrix (Most people would use QTGMC for general use) . Deshaker works better with progressive input. Resolve also works better with progressive input



LWLibavVideoSource("00186.mts")
AssumeTFF()
QTGMC()
ConvertToRGB24(matrix="rec709")

JK1974
19th October 2021, 19:24
I just updated my first post, embedding the images.
The Rec601 vs. 709 thing is what I also had in mind.
However,
AudioDub(LWLibavVideoSource("F:\AVCHD temp\00186.mts").AssumeTFF(),LWLibavAudioSource("F:\AVCHD temp\00186.mts")).ConvertToRGB24(matrix="rec709")

gives me the same bad results when watched in VirtualDubMod2.
The result exported from Davinci Resolve looks correct when opened in VirtualDubMod2 - using interlaced output settings and the appropriate codecs (Quicktime DXnHD 1080i 220/185/175 10-Bit or Grass Valley HQ 1920x1080 with interlaced enabled).

poisondeathray
19th October 2021, 20:51
I just updated my first post, embedding the images.
The Rec601 vs. 709 thing is what I also had in mind.
However,

gives me the same bad results when watched in VirtualDubMod2.
The result exported from Davinci Resolve looks correct when opened in VirtualDubMod2 - using interlaced output settings and the appropriate codecs (Quicktime DXnHD 1080i 220/185/175 10-Bit or Grass Valley HQ 1920x1080 with interlaced enabled).

It's the chroma upsampling.

If you're keeping it interlaced the whole way, use ConvertToRGB24(matrix="rec709", interlaced=true)

JK1974
19th October 2021, 21:24
It's the chroma upsampling.

If you're keeping it interlaced the whole way, use ConvertToRGB24(matrix="rec709", interlaced=true)

Thanks a lot, this really solved it!