h264 AVCHD raw footage

Dear friends,

I found some AVCHD raw footage on the internet for testing Kdenlive:

http://file.meyersproduction.com/hg10/00009.MTS.zip

http://file.meyersproduction.com/hg10/00011.MTS.zip

http://file.meyersproduction.com/hg10/00019.MTS.zip

Any downloading links for testing latest MLT/kdenlive developments?

In reply to Dan, I have a bi-core AM2 computer.
I may buy a Phantom quad-code processor.

Kind regards,
Jean-Michel

I tested:
inigo 00019.MTS

Decoding works fine but is not multi-threaded.
I can see the activity of my AM64x2 stuck to 50%.

Kind regards,
Jean-Michel

When building the ffmpeg that MLT is using, did you --enable-pthreads? If you are using --avformat-svn, you need to supply this additional option to --avformat-svn-extra.
Finally, did you enable multi-threading for the MLT module either through the threads property or MLT_AVFORMAT_THREADS environment variable? It is not on by default.

jmpoure wrote:
I found some AVCHD raw footage on the internet for testing Kdenlive:

http://file.meyersproduction.com/hg10/00009.MTS.zip

ffmpeg does not yet support interlaced AVCHD. The above causes ffplay to issue "[h264...] PAFF interlacing is not implemented." That is why I asked if you know of any progressive AVCHD with which to test.

ddennedy wrote:
ffmpeg does not yet support interlaced AVCHD. The above causes ffplay to issue "[h264...] PAFF interlacing is not implemented." That is why I asked if you know of any progressive AVCHD with which to test.

Your ffmpeg is out of date :) or you should enable h264 decoding.
--enable-libx264
I can use inigo to watch00009.MTS and 00019.MTS, slowly, but it works on my computer.
This is a test video shooting a fountain.

I am sure that ffmpeg now supports PAFF interlaced AVCHD.
This was a main development months ago.

export MLT_AVFORMAT_THREADS=2 ; inigo 00019.MTS
still consumes 50% of my AMDx2
I see no difference with MLT_AVFORMAT_THREADS=1

I compiled today's ffmpeg ... it rocks.

It contains optimizations, now inigo plays very smoothly.
inigo does not seem to reach more than 100% of one CPU core.

jmpoure wrote:
Your ffmpeg is out of date :) or you should enable h264 decoding.
--enable-libx264

libx264 is used only for encoding

jmpoure wrote:
I am sure that ffmpeg now supports PAFF interlaced AVCHD.
This was a main development months ago.

I stand corrected. I tested on one of the above with on my work computer with a dated ffplay. I just updated, and it does work.

Also, I was generalizing with the claim "interlaced AVCHD" because while the above clips work, AFAIK, it is still incomplete with some clips reporting:
"[h264 @ 0xbf3220]Interlaced pictures + spatial direct mode is not implemented"

ddennedy wrote:
Also, I was generalizing with the claim "interlaced AVCHD" because while the above clips work, AFAIK, it is still incomplete with some clips reporting:
"[h264 @ 0xbf3220]Interlaced pictures + spatial direct mode is not implemented"

I though spacial direct mode was used for digital HD channels, not camcorders.
Did you find some camcorder footage with spacial direct mode?

Yes, it was from a camcorder, being played with ffplay from sometime December on yet another computer. Then, I updated ffmpeg on that system, and those messages went away. Now, I just get some other occasional messages that less alarming especially since the picture looks rather good.

Is inigo playing the AVCHD for you nearly as smooth as ffplay? It's not for me. What is your inigo command line?

An example of mine:
inigo -profile atsc_1080i_60 00009.MTS threads=2 -consumer sdl rescale=none

For a pure clip playback scenario the rescale=none on the consumer is good to make it use the XVideo hardware scaler instead of the MLT software scaler. However, in a project with mixed resolutions, transitions, and compositing, you don't want to use that option.

ddennedy wrote:
Is inigo playing the AVCHD for you nearly as smooth as ffplay? It's not for me. What is your inigo command line?
An example of mine:
inigo -profile atsc_1080i_60 00009.MTS threads=2 -consumer sdl rescale=none

I tried several options but was not able to play clips from inigo:

inigo 00009.MTS -profile atsc_1080i_60 threads=2 -consumer sdl rescale=none
Usage: inigo [ -profile name ]
             [ -serialise [ filename.inigo ] ]
             [ -group [ name=value ]* ]
             [ -consumer id[:arg] [ name=value ]* [ silent=1 ] [ progress=1 ] ]
             [ -filter filter[:arg] [ name=value ]* ]
             [ -attach filter[:arg] [ name=value ]* ]
             [ -mix length [ -mixer transition ]* ]
             [ -transition id[:arg] [ name=value ]* ]
             [ -blank frames ]
             [ -track ]
             [ -split relative-frame ]
             [ -join clips ]
             [ -repeat times ]
             [ producer [ name=value ]* ]+

More than likely the avformat module was not linked to a dependent lib. Also, a common pitfall with avformat is to forget to supply --avformat-swscaler to mlt/configure when building against an ffmpeg that was configured with --enable-swscaler

ddennedy wrote:
More than likely the avformat module was not linked to a dependent lib. Also, a common pitfall with avformat is to forget to supply --avformat-swscaler to mlt/configure when building against an ffmpeg that was configured with --enable-swscaler

my command line was :

Quote:
./configure --prefix=/usr --enable-gpl --enable-shared --enable-theora \
--enable-vorbis --enable-libogg --enable-quicktime --enable-pp --enable-shared-pp \
--enable-motion-est --enable-sox --disable-mmx --avformat-swscale

I checked and ffmpeg was not compiled with --enable-swscaler.
I am recompiling ffmpeg and will report back.

You seem to be mixing mlt and ffmpeg configure options directly, which is non-sense. I realize there is some commonality between their options, and it is an easy mistake.

--enable-theora --enable-libogg --enable-pp --enable-shared-pp are all ffmpeg options, and mlt will ignore them as it does not understand them. You can safely remove them from future runs of mlt/configure.

Your configure command is linking the avformat module to a shared installation of ffmpeg. Last night, I updated the avformat configure script to use pkg-config, which will pull in all the right libs automatically. The only thing it can not do is know whether ffmpeg was built with --enable-swscaler as that info is not supplied with pkg-config. Can you please update mlt from svn to make sure you have the updated configure script? Then, run 'ffmpeg -version' to see what options it is built with, and look for --enable-swscaler. If it's there, then leave your mlt configure option --enable-swscaler. Otherwise, remove it.

Dan

by the way, what do you think are the "standard" configure options for mlt ? In the wiki I've found these:

./configure --prefix=/usr --enable-gpl --disable-mmx --avformat-swscale --enable-motion-est

As I'm now updating the script to automatically (more or less ;) )install kdenlive, I'll appreciate if you can give a clue on what options are the most suitable for most of the users.

Thanks in advance.
Regards.
JM

I followed guidelines, still does not work.

Quote:
inigo -profile atsc_1080i_60 00009.MTS threads=2 -consumer sdl rescale=none
Usage: inigo [ -profile name ]
[ -serialise [ filename.inigo ] ]
[ -group [ name=value ]* ]
[ -consumer id[:arg] [ name=value ]* [ silent=1 ] [ progress=1 ] ]
[ -filter filter[:arg] [ name=value ]* ]
[ -attach filter[:arg] [ name=value ]* ]
[ -mix length [ -mixer transition ]* ]
[ -transition id[:arg] [ name=value ]* ]
[ -blank frames ]
[ -track ]
[ -split relative-frame ]
[ -join clips ]
[ -repeat times ]
[ producer [ name=value ]* ]+

Any idea to check MLT?

Works for me here. Can you play other videos using inigo ? Did you remove your old MLT install as recommended in:
http://www.kdenlive.org/bbforum/viewtopic.php?f=6&t=455&hilit=#p1547

Thanks. After removing the old installation, it works for me.
But it seems that inigo is not backwards compatible, especially when effects are used.
Inigo displays "invalid".

I will report kdenlive issues in another thread.

j-b-m wrote:
Did you remove your old MLT install as recommended in

jmpoure wrote:
Thanks. After removing the old installation, it works for me.
But it seems that inigo is not backwards compatible, especially when effects are used.
Inigo displays "invalid".

I am struggling to understand why this is required. Previously, modules and .dat files were stored in .../share/mlt/modules. Now, only binary modules are stored in .../lib/mlt with not .dat files. The old stuff in share should be ignored by inigo. The revised code in libmlt just looks in lib/mlt, and the service names have not changed.

I suspect that my change to ld.so versioning might be to blame. I wonder if building new versions of MLT linked to an old installation of libmlt.so making it actually use the old logic but with some binary compatibility issues.

So, from an end user's perspective: can I edit 1080i AVCHD with Kdenlive? Just edit (cut off a few bloopers at the end of a scene, maybe join two scenes, simple stuff like that), not decode / recode. The files should remain essentially in the same format after editing.

I'm thinking specifically about AVCHD material produced by camcorders such as Canon HF10

At the moment, everything in MLT and therefore kdenlive gets re-encoded. There is no capability at the moment for stream copying. Also, I think ffmpeg is still not decoding all frames of some AVCHD, but I could be mistaken. I have to double-check that.

ddennedy wrote:
At the moment, everything in MLT and therefore kdenlive gets re-encoded. There is no capability at the moment for stream copying.

Oh, wow. :( My hopes for doing HD on Linux just sunk a little.
Transparent editing is pretty important. E.g., let's say I want to just chop off a few seconds at the end of a file - it would be quite pointless for the editor to re-encode anything (other than what's strictly necessary to rebuild the final GOP).

Also, modern AVCHD camcorders (like these newfangled flash-based ones) not only use for recording the same AVCHD codec used by Blu-Ray, but some (all?) actually create a full Blu-Ray image on the flash memory in real time. So in theory, one could simply dump the flash on a BD and obtain a 100% compliant Blu-Ray disk. Or dump it on a DVD-9, using the UDF 2.50 filesystem for burning, not the traditional 2.01 which is normally used for video DVD (e.g. the Windows app ImgBurn allows you to select the UDF version manually), and obtain a so-called "AVCHD" disk which is accepted by most BD players (e.g. PS3).
In this case, at most, some small editing might be required, but think about it - it would be a pity to re-encode anything while editing, since both the camcorder and the BD format would allow for a transfer with 0% quality loss. An editor that re-encodes would spoil this beautiful scenario.

Transparent editing is pretty important for those who care about PQ (picture quality).

Quote:
Also, I think ffmpeg is still not decoding all frames of some AVCHD, but I could be mistaken. I have to double-check that.

Honestly, all I care about is the particular AVCHD "flavor" generated by the new HD camcorders: 1080i, 60fps, long GOP, 15Mbps (the older models) or 17Mbps (the new ones) near-CBR. Here are some samples:

http://file.meyersproduction.com/hf10/

The HF10.dmg.zip is the archive of a .dmg file - the Mac equivalent of an .iso. I converted it with dmg2iso, mounted it, then extracted the .mts files - those are the AVCHD streams. The .dmg is the raw dump of a Canon HF10.
Please note that the filesystem on the .dmg is truncated to 8.3 - hence the AVCHD streams should really be .m2ts. A lot of other filenames are truncated on that image. I had to tweak it manually and make it identical to the naming conventions of a regular BD before burning it on a DVD with UDF 2.50.

Yes, I know pass-through or stream-copy is important. Stream copying is on the TODO list for MLT. However, MLT was not written for kdenlive or for video editing. It just so happens to be pretty damn good in that regard, so kdenlive adopted with some obvious limitations for now. Besides, a large class of users (arguably the majority) say they don't care because they do not output to Blu-Ray or DV devices--only Internet distribution. Another large class of users are advanced and will end up filtering nearly every single frame for color correction or some other reason. Your voice and vote have been noted.

Also, there is no single universal flavor of AVCHD, and I already have several samples including ones from Meyers Production. I will make sure that includes the ones in the HF10 archive. Don't worry, I have a MacBook Pro running OS/X too, and MLT runs on it as well. :-)

Dear Dan,

I am going to buy an HF10, which is a revolutionnary camcorder.
It produces very sharp h264 video nearly without artifact.

Passthrough editing a THE needed feature for MLT.
I know that are plenty of projects in the tube.

Keep on going.

Kind regards,
Jean-Michel

jmpoure wrote:
I am going to buy an HF10, which is a revolutionnary camcorder.
It produces very sharp h264 video nearly without artifact.

Passthrough editing a THE needed feature for MLT.

Well, from a larger perspective:

It looks like the AVCHD camcorders (flash, HDD, DVD) are finally catching up with the HDV ones (miniDV tape) in terms of PQ (picture quality). Which is odd because the AVCHD codec (H.264 MPEG4, 1920x1080i) should be better than HDV (MPEG2, 1440x1080i). Probably, MPEG2 + miniDV being older technologies, were a known quantity and manufacturers could squeeze all the PQ they could possibly squeeze out of them. Also, until recently, most AVCHD camcorders were encoding at 15Mbps which seems like it was not enough, even for H.264.
But things are changing now. There's finally at least one AVCHD camcorder family (the HF10 and HF100) that competes with HDV, due in part to the bitrate increase to 17Mbps, and there's almost unanimous agreement that the direction the technology will take in the future is towards MPEG4/AVCHD. Also, probably, solid state storage will become more and more popular.
So there are good reasons to support this technology (AVCHD) in the Linux-based video tools. Just editing AVCHD is one piece of the puzzle. The other two missing pieces on Linux are:
- (at least rudimentary) Blu-Ray authoring capabilities. AVCHD camcorders such as the HF10/100 produce a Blu-Ray structure in real time on the flash memory. So it's possible to just dump the whole thing on a BD or DVD-9. But if you edit the files, some rebuilding of the BD image might be necessary.
- UDF 2.50 burning capabilities. That's the filesystem used by the Blu-Ray disks (and also by the "AVCHD" disks, which are just DVD-5 or 9 with a standard BD file structure, and are compatible with most BD players and can hold more than 1 hour of AVCHD content)

I am trying to advocate the cause of digital HD video on Linux, since the technology is already accessible to the masses and we finally seem to know the direction it's going. It will take a while to get up to speed on Linux, but I think it's worth it.

P.S.: Hey Jean-Michel, you may want to look at the HF100 as well. It's significantly cheaper than the HF10 and the only differences are:
- the HF100 does not have the internal 16GB flash, it relies solely on the slot for external SDHC cards
- the nifty black paint job is missing on the HF100 ;)

To mention the other reasons why the H10 is interesting :
:arrow: No mecanical parts for recording.
:arrow: Robust metal body.

Also, it seems that picture quality is better than on the H20/H30.
So stick camcorders are not only catching up. They are the future.

Kind regards,
Jean-Michel

i've had my eye on HF100 since it was announced, i'm wondering what the price will be like in Europe and when will we get full support on linux... the future looks bright, but i'll be really mad if the manufactorers of AVCHD plan to upgrade their camcorder by 2mbs more each year... (just make it 24 and lets end the tape era)

I watched a footage and could see many-many artifacts.
Why is the comp-20k.mov file so bad, especially in 24P.

If this was shot in normal conditions, I am not going to buy this cam.
Can we compare comp-20k.mov to other HV20 files shot in the same situation.

Hello,

Please put me on the list of people that want to output to Blu-Ray or AVCHD-DVD at the highest possible quality. :)

I also have a Canon HF100, when I plug it to the HDTV the picture quality is fantastic. If I go through either kdenlive or iMovie, the loss in quality is absolutely striking.

I've done several tests with iMovie and I'm particularly annoyed by the fact that it reduces the frame rate from 60i to 30p. I would like to keep my video in 60i.

I haven't tested the latest versions of kdenlive. Let's say that I:

- accept the fact that there will be conversion and some loss of quality

- want to at least keep the format in 1920x1080 60i; no deinterlacing or frame rate reduction.

Is there a good pipeline to do that? Can kdenlive output to 60i?

If it helps, I can use ffmpeg to manually convert my clips to H264 files or even MPEG4 files with very high bitrate to use as an intermediate format (making sure to keep the clips as 1080/60i). I had to do that during my iMovie tests anyway.

As a plus (maybe this is already possible) I would like to output to Standard-Def 480/60i, for people that don't have a Blu-Ray player. (Please don't tell me kdenlive also converts it to 30p...)

 

Cheers!

Eduardo

 

Yes, Kdenlive supports 60i output if you use at least version 0.7.3 and the appropriate Project Setting.

I have posted a new, downloadable render profile for DNxHD .mov output that you can use to convert the AVCHD footage for better compatiblity with Kdenlive. It will appear in the Lossless/HQ > Custom category after you download it via Settings > Download New Render Profiles....

Great! Good news, thanks.

Since my last post I installed the latest Ubuntu version of Kdenlive, ran into the "almost all output formats are disabled" bug, and already fixed it.

Did you mean: convert the original AVCHD files to DNxHD and edit using DNxHD?

Interesting, I'll try that. I assume there's also a performance improvement with editing DNxHD compared to AVCHD? I could use some performance improvement too! :)

My Linux computer is old but it has lots of hard disk space, which is probably the case of a lot of people that have secondary computers for running Linux. So I'm not worried about big intermediate files, I can handle them! I'm more worried about good output quality and good editing performance on a single-core machine.

Cheers

Echo eduardo.

It would be nice to have some way to batch-render a whole directory full of .mts files in advance of commencing editing . . . ? At this point it seems the only way to do this is to load each file and set up a render one at a time.

On the other hand, direct AVCHD editing at this point isn't too bad on my HF100 files. There are a few glitches:

  • About 1 in 20 clips doesn't seem to always render - I get grey video over correct audio for the clip duration.
  • Trimming the clip by dragging the left or right in-out points can result in screwed up playback for that clip.
  • Playback in the timeline monitor works quite well if you start playback from the clip beginning. If you play from the middle of the clip usually nothing plays until the cursor reaches the following clip.

Despite this, it's surprisingly usable and I've done some nice projects already. So I'm wondering if maybe AVCHD editing is close to being more or less solved, and maybe in the next release these difficulties may clear up.

ArtInvent, you can use ffmpeg on the command line to do batch conversion. You don't need to go through kdenlive for that. I'll post a script later tonight.

I think I had the same glitch you had, in which some clips render as gray. I have a project in which the last clip fades to black. In the rendered output, the last clip is turning out as a gray screen, which then fades to black. I thought it was a fade bug, but it's likely that it's the same AVCHD bug that you have.

I have your other issues too (trimming and  playback from the middle), but they are minor since they don't affect the output.

And I have a fourth issue: sometimes, between clips, there is one black frame. It's a very quick black flash. Have you had it? I've set up my project by adding several clips to the timeline at once, in one drag operation. So in theory they should be touching perfectly, with no space between them. This only happens on the rendered output.

 

I think I've noticed the black frame or some kind of glitch between clips in rendered. It's quite minor.

I have one clip that I really needed where the first few seconds the image rendered in slow playback and the sound got out of sync. I did pre-render that to very hi-bit mpeg-4 intermediate - but then it cleared up and seems to be okay now. About the only thing I changed since then is I installed 3-4 extra libs that are marked 'unstripped' that hadn't been installed before. Have no idea if all of these are necessary but here's all I have:

libpostproc-unstripped-51,libavdevice-unstripped-52,libswscale-unstripped-0,libavfilter-unstripped-0,libavutil-unstripped-49,libavcodec-unstripped-52,libavformat-unstripped-52

Also, I still don't have frei0r installed, as I really don't have much need for effects at this time.

Kdenlive was also crashing before and now seems much more stable.

The other problem I have is that 1080 x264 renders don't seem to want to play at all and hang mplayer pretty badly.

I'm in the process of setting the www.avenard.org repos for Jaunty, which have updated mencoder, mplayer, x264, and most importantly the 180.51 nvidia driver rather than what I'm using now (180.44). Hoping this might help matters some. Must reboot now.

 

 

Yes, the idea is to convert your AVCHD to DNxHD for editing. And, of course you can script it. You could convert my avformat properties in that render profile to ffmpeg options and use ffmpeg. Or, you can use e.g. 'inigo -profile atsc_1080p_25 some.mts -consumer avformat:some.mov <my avformat properties from the profile>'. If you add threads=N (-threads N for ffmpeg), you can do multi-threaded encoding.

You do not need to convert the clip in its entirety, but if you trim the beginning (use an in point), then you run the risk of a non-clean transcode. DNxHD is a bit faster, but I also just submitted a small change to MLT to make seeking/scrubbing even faster.

 

To Artinvent: Here is my scripts to batch convert videos. Are you on Linux?

 

until [ -z "$1" ]
do
    ffmpeg -y -threads 2 -i $1 -acodec libfaac -ab 256k \
        -vcodec mpeg4 -vb 36M -s 1920x1080 -intra -flags +ildct+ilme $1.mov
    shift
done

I saved it as "ffmpeg-1080i" and put it in my /usr/local/bin. The usage is: ffmpeg-1080i *.MTS

It converts all .MTS files in the current directory. Just leave it running overnight!

Eduardo

 

Edit: Of course you're on Linux, if you're using kdenlive! :) I asked that because ffmpeg itself is cross-platform, and I also have it in my Windows and Mac computers. Hopefully you can put the script above in a text file, save it and use it, there are a few different ways to do that, let me know if you have problems.

Noooo don't use the Apple MOV container. Use MPEG-4 (.mp4) or Matroska (.mkv) instead!

Thanks eduardo. I will be trying this. And yes, I'm on Linux, Ubuntu 9.04 64.

One thing - this is using the regular mpeg4 codec, right? Not the near-lossless codec we were talking about? Or am I missing some trickery?

 

Right now the 'overnight down time' on my computer is being taken up rendering some Blender files in HD. It takes about four hours to render 10 seconds of finished video at 1080p  - !

What is wrong with this picture? It would surely be nice if more video software would start taking advantage of the GPU which just sits there staring at it's navel and twiddling it's thumbs while all this video/transcoding/3D rendering is going on.

hi

i have the same problem, buy an avchd cam because it's not easy to find affordable no-avchd cam and i need to convert to mp4 (or other) because i don't have a Cray one laptop ...

So there is a lot option for ffmpeg to convert avchd to mp4 ... if you can rapidly how to do that without big loss in quality ...

 

thanks

 

 

 

ArtInvent:

No, that script uses regular mpeg4. I was looking into DNXHD and the bitrate is WAY too big :( It only supports a few fixed high bit rates (table here: http://www.avid.com/resources/whitepapers/dnxhd.pdf). I know I said I have a lot of disk space, but I don't have any perceptible loss when converting to MPEG4 720p (q=1.6), and I already have good editing performance on single core with it. I'm afraid I may run into hard disk transfer bottlenecks rather than CPU bottlenecks, with such high bit rates. I may try it when I have to do a really professional project. For now it's just home recordings.

Anyway, if you want to try it, change MPEG4 to DNxHD on the script above, and be sure to use one of the valid bitrates from the pdf above or you'll get an error. For example, for 1080/60i use "-vb 145M".

nyme:

The script I posted above converts avchd to mp4 if you change the file extension from .mov to .mp4. There's no big loss in quality.

 

Eduardo