rendering movies from Canon XA10

Hi,
I just got my new Canon XA10 camera and trying to edit clips from it.
Previously I successfully used kdenlive for several years to edit movies from Canon HV20.
I am having trouble choosing a suitable profile for rendering. Whatever I tried, seems to look somewhat (often a lot) worse than the original. The best output comes when choosing mp4 or (surprisingly) webm but still that is not good enough for me. I'd like the output to be indistinguishable in quality from the source. Otherwise, what's the point having such an expensive camera. I am using the highest quality video settings in XA10, shooting in the default 60i (which is reported as 59.96 but imported into kdenlive as 59.94, is that a problem?).
Anybody has some suggestions or worked out some workflow for XA10? Maybe not to edit the original clips but transcode them into something else before editing?
Or maybe I should shoot video in 30p or 24p?
I never had such problems with my old HV20. I just rendered everything as mpeg2 with the highest quality settings and the result was indistinguishable from the source in quality.
Thank you,
Igor

Forums:

From the spec sheet the XA10 shoots 24p, 30p, 60i (interlaced) or 30p in a 60i container. So a bit of a confusion there with the 60i, is default settings interlaced or not I wonder?

Hopefully default is 30p in a 60i flagged container and therefore a 30p 1920x1080 progressive project should do it. No wonder it looks bad if it's progressive interpreted as interlaced. If it is 60i then a 1920x1080 60i interlaced project profile should do it.

Whether you choose 24p, 30p or 60i is personal choice. For me I'd use 24p for general shooting and 60i with a 1/125th shutter for slow motion, combined with a decent deinterlacing & frame doubling script like QTGMC with Avisynth.

Canon suggests it's a Professional camera yet uses a stupid progressive flagged as interlaced container format like it did with the HV20, no reflection on the ability of the camera, just the pita format camera manufacturers seem to use on the lower end of the range, relatively speaking, again no reflection on the abilities of the camera.

I would think it is interlaced and I am using 1920x1080 59.94 interlaced project profile. But I am not expert and might be wrong. Is there a way to find out with some Linux tool?
For example, HandBrake reports it as h264, 1920x1080, 16:9, 29.97

mplayer -identify
says:
=========
ID_DEMUXER=mpegts
ID_VIDEO_FORMAT=0x10000005
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=1920
ID_VIDEO_HEIGHT=1088
ID_VIDEO_FPS=29.970
...
ID_VIDEO_CODEC=ffh264
=========
vlc says:
=========
Original ID: 4113
Codec: H264-MPEG AVC (part 10) (h264)
Frame rate: 59.940060
=========
kdenlive itself says:
=========
Video codec: H.264/AVC/MPEG-4 AVC/MPEG-4 part 10
Frame size: 1920x1080
Frame rate 59.960041
Scanning: interlaced
Pixel aspect ration: 1.0000
Pixel format: yuv420p
Colorspace: ITU-R 709
=========

I just tried 29.9p, 30p, 59.94i, 60i profiles and rendered into mpeg2/4. The results are no better.
The quality of output is not too bad but one can still see that it is worse than the original. I suspect some tiny parameters of render profiles need to be tweaked but I have no idea where to start.

You could try stepping through the frames in VLC making sure deinterlacing is off and you should then see regular horizontal lines in each frame if its interlaced, no lines if its progressive.

FFmpeg has had major problems with decompressing interlaced h264 and I'm not aware of those problems being resolved.

Perhaps shooting progressive, the decent choice anyway, to avoid the whole interlaced thing.

Otherwise try remuxing with mkvmerge perhaps might help a bit.

There are lossless encoder profiles for h264 and huffyuv to use if you want to test with rather than tweak encoder settings.

I do not see any obvious lines when stepping through the original clip in vlc. But I am not sure just how visible they should be at 1920x1080 resolution on 24" screen.
mkvmerge -o out.mkv in.MTS
produces a file that neither mplayer nor vlc can play. mplayer complains:
========
Too many buffered pts
[h264 @ 0x7f6bef854020]slice type too large (1) at 0 0
[h264 @ 0x7f6bef854020]decode_slice_header error
[h264 @ 0x7f6bef854020]AVC: nal size -736516917
[h264 @ 0x7f6bef854020]no frame!
Error while decoding frame!
V: 0.0 0/ 0 ??% ??% ??,?% 0 0
========
and does not show any video. vlc does show some video but is is not playing at the right speed, too fast.
Notice that original MTS files are played fine by both mplayer and vlc.

HuffYUV lossless profile produces video with some artifact lines near the bottom.
MPEG-2 lossless profile also has some artifacts at the bottom. Not sure if all those artifacts are real or it is just my computer suffocating. I do use quite powerful laptop with SSD,16G RAM, 2G video memory, 8-core i7-2920XM CPU @ 2.50GHz.
MPEG-4 lossless profile produces a video close to the original quality but still slightly worse and again too heavy for my computer. Mplayer complains:
===========
A: 12.9 V: 12.5 A-V: 0.374 ct: 11.626 0/ 0 75% 24% 2.0% 387 0
Too many video packets in the buffer: (41 in 34282557 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

===========
H264 lossless slow produces video of the original quality but one practically cannot play it. It is so heavy that it runs probably 10 times slower that it should.
H264 lossless fast (I guess here fast/slow refers to how fast/slow the encoding is done?) similar to the previous but plays a little bit faster but still not fast enough.

kdenlive can also transcode the original clips rather than the end product. I tried lossless mkv: cannot play it with mplayer at all, I guess, it is using mkvmerge under the hood.

cinelerra would not even recognize MTS as a valid input format.
lives would not recognize MTS file.
avidemux can do some transformations, for example, into avi file.

I would really hate to have to use some commercial editor under Windows!

Interlacing is very visible, you won't miss it, with VLC just make sure deinterlacing is off when stepping through. Here's an example of interlaced and deinterlaced HDV mpeg2: http://www.yellowspace.webspace.virginmedia.com/sample.zip

The mkv route was just for kdenlive's benefit as ffmpeg has no problem with matroska container. Media Players like VLC may have problems as you've found.

The lossless rendering was not meant as final delivery format for smooth playback but as a method of checking kdenlive output / handling of your MTS files without additional confusion over whether encoding settings are good enough as you mentioned in your inital post.

The reason I suggested mkvmerge rather than kdenlive for remuxing / transcoding your MTS files was to avoid ffmpeg which I mentioned previously has problems with interlaced h264.

MTS is just a container like mp4, mov, mkv but less well supported. You could remux your MTS files into mp4's with ffmpeg something like ffmpeg -i file.MTS -vcodec copy -acodec copy file.mp4 but I don't think this will help much with interlaced h264 content, best to avoid interlaced as mentioned previously.

If you could provide a sample MTS file that may help.

Deinterlacing was off in vlc. So, I guess, it is not really interlaced.
Here is a public dropbox link to 65 Mb sample file that I was playing with:
http://dl.dropbox.com/u/20128629/00016.MTS

I took a script that kdenlive generated to render MTS into webm and increased some quality parameters manually:

vb=25000k qmax=10 qmin=2
instead of
vb=12000k qmax=42 qmin=10

That multiplied the file size by a factor of 4 but the quality improved and approached the original. Of course, now it is difficult to play this file:
=====
Too many video packets in the buffer: (172 in 33609373 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
A: 20.3 V: 17.6 A-V: 2.736 ct:139.567 0/ 0 143% 6% 0.8% 340 0
=====
but probably I am on the right track.

Hi Igor, had a quick look at the MTS thanks, it does look like interlaced when zoomed in and in frames with more motion, like the zoom to the tree the interlacing is more evident, but it seems a lot finer than the sample I gave possibly due to frame rate differences between your sample and mine. So you could try an interlaced project and render to perhaps mpeg2 interlaced or deinterlace filter in kdenlive and render h264 progressive.

Not sure what the quality of deinterlacing is like in kdenlive, personally as mentioned previously I use QTGMC plugin with Avisynth and only use interlaced for slow motion creation.

I'm happy to provide a frame of deinterlaced via QTGMC later today, to compare to kdenlive's deinterlace method, if that's of interest to you but maybe it's best to shoot some progressive and use kdenlive with that?

Hi yellow,
At first glance, I do not see in kdenlive any user friendly option to deinterlace. Is there? Or is it already built into the existing project/rendering profiles? I guess, I might have to use something like ffmpeg (has problems with interlaced h264?), ffmbc (a fork of ffmpeg? same problem?), avidemux (does not depend on ffmpeg?) or QTGMC (does it work under windows only?) to deinterlace first or modify by hand the generated rendering script (not clear to me if melt depends on ffmpeg and would suffer from the same problems).
I'll try to shoot in progressive as well and see how it looks.
I would be very interested to see your result of deinterlacing my clip with QTGMC.
I believe I always worked with interlaced video from Canon HV20 and never had any problems rendering at the same quality as the original (which was typically excellent under good light condition). I guess, it is a difference between HDV and AVCHD formats and their support under Linux.
Thank you,
Igor

I tried rendering into progressive h264 (kdenlive does have an option to force progressive or interlaced rendering, although I do not see any way to set parameters for deinterlacing, I guess, one is just supposed to modify the generated scripts) and I think the quality is comparable to the original. Or my eyes got tired? Not sure. Can you, please, take a look and compare to the original:
http://dl.dropbox.com/u/20128629/00016_p.mp4
Does it look to you worse than the original or not?

Some people suggest to transcode clips into more editor-friendly format than AVCHD, for example, DNXHD. But does it really affect the end result or only editing convenience? I have so far no trouble directly dealing with AVCHD files in kdenlive as far as performance is concerned.

hi, my apologies deinterlacing is not via a filter but as you have found, forcing progressive in render dialogue. Rather than forcing progressive for a clip, that is for when ffmpeg detects a clip as interlaced but the user knows it to be progressive and can overide ffmpeg.

YADIF is the deinterlace method used and is a good balance between speed and quality, expect Dan the MLT developer has set decent parameters of those available. But we do generally loose half the vertical resolution. QTGMC is more useful for retiming & frame interpolation for slow motion but I'll do a comparison anyway. Avisynth runs happily under Wine on Linux.

I'll take a look at the dropbox sample and get back to you later.

Kdenlive offers a decent proxy workflow so transcoding is not generally necessary for editing and is reducing quality, whether that's visible to the naked eye is not always so clear.

re HV20 and interlaced, it can be decent enough to render out as interlaced and let the media playback handle the playback whether that includes deinterlacing or not dependant on TV or monitor etc, the parameters can sometimes be set by the user too, but also I think I'm correct in saying that if any color grading is done on the interlaced clips in RGB then the source or a copy of the source frame has to be deinterlaced by the NLE anyway and then reinterlaced.

Pages