[Kdenlive-devel] Editing AVCHD h264/AC3 files in kdenlive

sean darcy seandarcy2 at gmail.com
Sun May 3 20:36:14 UTC 2009


On 05/02/2009 07:40 PM, sean darcy wrote:
> Dan Dennedy wrote:
>> On Fri, May 1, 2009 at 10:15 AM, Dan Dennedy<dan at dennedy.org>  wrote:
>>> On Thu, Apr 30, 2009 at 1:52 PM, sean darcy<seandarcy2 at gmail.com>  wrote:
>>>> sean darcy wrote:
>>>>> Dan Dennedy wrote:
>>>>>> 2009/4/17 Andre Madeira<amadeirabus at gmail.com>:
>>>>>>> Hello kdenlive-devel!
>>>>>>>
>>>>>>> My goal is to edit AVCHD (h264/AC3) files in kdenlive. The videos are
>>>>>> It is not yet ready.
>>>>>>
>>>>>>> generated from my Panasonic HDC-SD1 camcorder and are all interlaced or
>>>>>>> 1080i. For what is worth, I can play these files properly on my linux box
>>>>>> Playing sequentially is one thing, seeking is another, and editing
>>>>>> requires seeking. In ffplay, try clicking around on the window. The X
>>>>>> axis determines the seek percentage. It is not clean. This was being
>>>>>> addressed a couple of months ago, and great progress was made;
>>>>>> however, the effort has stalled.
>>>>>>
>>>>> So if we want to edit AVCHD, we need to convert them first? What should
>>>>> we convert them to ( .avi?)? And how?
>>>>>
>>>>> googling found this script:
>>>>>
>>>>> xporthdmv -hn $file 1 1 1&&  mv bits0001.mpa $audiofile
>>>>> ldecod -i bits0001.mpv -o $videofifo&
>>>>> ffmpeg -r 29.97 -s 1440x1080 -i $videofifo -i $audiofile -vcodec mpeg4
>>>>> -sameq -acodec copy -aspect 16:9 -b 15000k outfile
>>>>>
>>>>> which uses xport from http://www.w6rz.net/ and ldecod from
>>>>> http://iphome.hhi.de/suehring/tml/download/ .
>>>>>
>>>>> xporthdmv demultiplexes the .ts file, then ldecod decodes video to YUV (
>>>>> 4.2.0?).
>>>>>
>>>>> Is this how it's done? Can kdenlive now edit the resulting file?
>>> Can you not just use ffmpeg? I thought the main remaining issues with
>>> ffmpeg were seeking and multi-threaded decode, which a conversion to
>>> uncompressed via ffmpeg should be fine.
>>>
>>>>> sean (a potential new owner of an avchd camcorder)
>>>> Actually, if ldecod converts the h264 video to yuv, shouldn't you leave
>>>> it alone, and just use ffmpeg to multiplex the audio:
>>>>
>>>> ffmpeg -i $videofifo -i $audiofile -vcodec copy -acodec copy outfile.avi
>>> Sure, and you can use HuffYUV if you want to reduce file size and I/O a little.
>> Trying things out here, and I get better (more stable, better
>> performing) results with DNxHD:
>>
>> ffmpeg -i 00009.MTS -s 1920x1080 -r ntsc -b 220000k -threads 2 -vcodec
>> dnxhd -acodec copy 00009.mov
>>
> Well, maybe more stable for you.
>
> I grabbed canon-hf-100-1080p-psf.mts from the kdenlive/supported cameras
> site.
>
> I can load the clip and play it in kdenlive - looks pretty good. Here's
> the cli output:
>
> kdenlive
> QPainter::fontMetrics: Painter not active
> ALSA lib pulse.c:272:(pulse_connect) PulseAudio: Unable to connect:
> Connection refused
>
> SDL failed to open audio: No available audio device
>
> But with both conversions ( i.e as I did with rawvideo and yours with
> dnxhd kdenlive segfaulted as I opened the clip:
>
> kdenlive
> QPainter::fontMetrics: Painter not active
> kdeinit4: preparing to launch
> ALSA lib pulse.c:272:(pulse_connect) PulseAudio: Unable to connect:
> Connection refused
>
> SDL failed to open audio: No available audio device
> <unknown>: Fatal IO error 9 (Bad file descriptor) on X server
> localhost:14.0.
> KCrash: Application 'kdenlive' crashing...
> sock_file=/root/.kde/socket-intel64-office.hiddenbrook/kdeinit4_localhost_14
> kdeinit4: preparing to launch /usr/libexec/kde4/drkonqi
> Unable to start Dr. Konqi
>
> So we converted clips so kdenlive would find it easier to use them, and
> now look what we've done :(
>
> sean
>

We have two issues - the seg faults only happen if I'm ssh'ing from my 
portable. Why it doesn't happen if I'm playing the .mts clip is really 
strange.

But even on the server, the two converted clips don't play well.

So I got  canon-hf-100-1080p-psf.mts from
http://www.kdenlive.org/video-editor/canon-eos-5d-markii

Then converted them as follows:

ffmpeg -i canon-hf-100-1080p-psf.mts -s 1920x1080 -r ntsc -b 220000k 
-threads 0 -vcodec dnxhd -acodec copy dnxdh.mov

Input #0, mpegts, from 'canon-hf-100-1080p-psf.mts':
   Duration: 00:00:45.12, start: 0.820067, bitrate: 15789 kb/s
   Program 1
     Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 
16:9], 50 tbr, 90k tbn, 50 tbc
     Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Output #0, mov, to 'dnxdh.mov':
     Stream #0.0: Video: dnxhd, yuv422p, 1920x1080 [PAR 1:1 DAR 16:9], 
q=2-31, 220000 kb/s, 30k tbn, 29.97 tbc
     Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Press [q] to stop encoding
[h264 @ 0x234f2b0]missing picture in access unit7.20 
bitrate=220236.6kbits/s
frame= 1125 fps= 26 q=1.0 Lsize= 1009421kB time=37.54 
bitrate=220291.1kbits/s
video:1008000kB audio:1410kB global headers:0kB muxing overhead 0.001110%

and:

ffmpeg -i canon-hf-100-1080p-psf.mts -s 1920x1080 -r ntsc -b 220000k 
-threads 0 -vcodec rawvideo -acodec copy rawvideo.avi

Input #0, mpegts, from 'canon-hf-100-1080p-psf.mts':
   Duration: 00:00:45.12, start: 0.820067, bitrate: 15789 kb/s
   Program 1
     Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 
16:9], 50 tbr, 90k tbn, 50 tbc
     Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Output #0, avi, to 'rawvideo.avi':
     Stream #0.0: Video: rawvideo, yuv420p, 1920x1080 [PAR 1:1 DAR 
16:9], q=2-31, 220000 kb/s, 29.97 tbn, 29.97 tbc
     Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Press [q] to stop encoding
[h264 @ 0x15ed2b0]missing picture in access unit7.37 
bitrate=746018.0kbits/s
frame= 1125 fps= 17 q=0.0 Lsize= 3418658kB time=37.54 
bitrate=746071.2kbits/s
video:3417188kB audio:1410kB global headers:0kB muxing overhead 0.001776%

As before, kdenlive has now problem playing in clip monitor the original 
.mts file.

The dnxdh.mov file plays as flat gray - no figures, no motion. Just 
gray. FWIW, mplayer won't play it either.

rawvideo.avi does better ( though it's 3.5x the file size of dnxhd), but 
after 20 seconds starts stopping and stuttering.

So I have yet to find a way to convert an mts file to something kdenlive 
likes.

When I have time, I'm going to try xport and ldecod.

sean





More information about the Kdenlive mailing list