Log in

View Full Version : Interfacing AviSynth with NLEs via XML


chaynik
20th July 2010, 22:25
I'm curious if anyone had interest in or attempted to translate project files from popular non linear editors such as Final Cut and Vegas into AVS scripts. It would be great to be able to use either of those to do the creative offline edit (http://en.wikipedia.org/wiki/Offline_editing) and then use AVISynth for the online assemble (http://en.wikipedia.org/wiki/Online_editing), working with the uncompressed source media. All common editing operations like cuts, fades and dissolves could easily be replicated in AVISynth. For edits like cutdowns and regional versions, such a workflow could save hours upon hours of intermediate rendering and exporting.

Both Final Cut and Vegas support XML exports of their projects that should be fairly easy to work with. I had a friend whip up an XSLT stylesheet that took a simple final cut xml and outputted a bunch of AVS trim() statements. It worked great, but a lot more is possible!

chaynik
18th August 2010, 12:28
Anyone?

IanB
18th August 2010, 23:42
Publishing the friends XSLT stylesheet might encourage a few nibbles.

tin3tin
19th August 2010, 08:12
There has been a few attempts on .edl(edit decision list) conversion. This is a format most NLEs support.

http://forum.doom9.org/showthread.php?t=146727&highlight=edl (http://forum.doom9.org/showthread.php?t=146727&highlight=edl)

I tried myself:
http://forum.doom9.org/showthread.php?t=147106&highlight=edl

And here some functions to help doing the editing:
http://forum.doom9.org/showthread.php?t=155208&highlight=edl

Warperus
19th August 2010, 09:51
I don't see a reason for rendering full project in avisynth once you have commercial NLE in hands.
You can always render your project variation in no-recompress mode from common predendered files (in format specific to NLE, but that's not a problem).
You can also use some external tool like avidemux to make similar cuts without recompression.
What is it in avs scripts that will make this task easier or quicker? If you think avisynth will be able to avoid rendering, you are completely wrong - it always does full processing. In that regard NLE prerenders are a step ahead already.

If you need thorough rendering done quicker you can use network rendering in Vegas. It can render a movie on several different computers.

There are specific processing tasks that can be done better in avs scripts/avs hosting applications, but it's not a big problem to do them in advance or after full rendering in NLE.

P.S. From my point of view it would be better to inject avs scripts into NLEs. We'd be able to use whole variety of avs plugins directly in NLEs. But that's another matter.

tin3tin
19th August 2010, 10:28
I don't see a reason for rendering full project in avisynth once you have commercial NLE in hands.
Is there any reason for using Avisynth at all if you have a commercial NLE? :)

In my eyes if you want to code up a NLE GUI for Avisynth an edl parser(or something like it) is needed to avoid ending up having the GUI to generate extremely complicated avisynth scripts - a parser would make the process more simple. And I like the idear of using a NLE for fast proxy-editing and then using Avisynth for the hi-res final render.

P.S. From my point of view it would be better to inject avs scripts into NLEs. We'd be able to use whole variety of avs plugins directly in NLEs. But that's another matter.
There are already a few solutions for importing/frameserving avisynth script into various NLEs. And some builds of Blender allows import of .avs files.

Warperus
19th August 2010, 12:43
Is there any reason for using Avisynth at all if you have a commercial NLE?
Much wider list of filters with full control of processing. Deinterlacers, deshakers, sharpening filters, resize filters etc. You can choose what where and how to use.
Also you don't have to pay for special version of NLE plug-in if you use avisynth filter.

GUI to generate extremely complicated avisynth scripts - a parser would make the process more simple
I really doubt it will make process more simple. Fancy effect consists of thousands keypoints in NLE. You will have to follow every step here. Resulting script will be nearly completely unreadable. Back to batch processing in black boxes? We are back to commercial NLE concept then.
The complexity of edl parser lies in following every single NLE behaviour procedure. You have to either have ability to load NLE plugins and emulate NLE structure or emulate effects of those plugins. Good luck in emulating commercial plugins, not even saying about hundreds of build-in plugins for every NLE, emulation of NLE processing behaviour etc.

There are already a few solutions for importing/frameserving avisynth script into various NLEs. And some builds of Blender allows import of .avs files.
Both are just substitution for processed files. If you don't have disk space for such operation it's all good, but that's it. It does not add usability, only marginally speeds up few operations in easy cases and saves few Gb on your hard drive.
Encoding for modern codecs generally takes a lot of time and you can't speed up this operation with avs scripts. Even more, you can slow down encoding/rendering if you include tough avs script in multi-pass processing (script will run for every pass of encoding/rendering).

tin3tin
19th August 2010, 14:28
I wonder did you look at those links I posted above?

I really doubt it will make process more simple. Fancy effect consists of thousands keypoints in NLE. You will have to follow every step here. Resulting script will be nearly completely unreadable. Back to batch processing in black boxes? We are back to commercial NLE concept then.
The complexity of edl parser lies in following every single NLE behaviour procedure. You have to either have ability to load NLE plugins and emulate NLE structure or emulate effects of those plugins. Good luck in emulating commercial plugins, not even saying about hundreds of build-in plugins for every NLE, emulation of NLE processing behaviour etc.

The .edl format does not support "fancy effects" or plugins. It was originally invented for the offline/online procedure and cutting of negatives in labs(and still used for this purpose).

rfmmars
20th August 2010, 01:55
[QUOTE I don't see a reason for rendering full project in avisynth once you have commercial NLE in hands.
QUOTE]

Are you kidding? Using any of the Magix's "Movie Edit Plus" version's, you can have any amount of "Avisynth and Virtialdub" frame servers going at one time, plus use most of Virtiualdub filters on a frame to frame basis inside Magix's Edit Pro, it's the only editor that can do that.

Richard

Warperus
20th August 2010, 11:42
I wonder did you look at those links I posted above?I did.

The .edl format does not support "fancy effects" or plugins.Have you seen "edl" in first post of this thread?
As I see chaynik's idea is to export project with as much details as possible. And that's a huge work to do.
If you stick to edl->avs parser then it's rather doable job for common eld and it won't really take months of work provided you have edl specification. But as you mentioned youself it might be just a first step to exporting whole project.

plus use most of Virtiualdub filters on a frame to frame basis inside Magix's Edit Pro, it's the only editor that can do that.
That's exactly what I was talking about. Most of commercial NLEs lack the variety of filters available in avisynth enviroment and it might be fruitful to give NLEs ability to use these filters (and/or avisynth scripts).
I have heard of few VD filters ported to Vegas, but that's a minor exception.

chaynik
15th March 2011, 11:08
Publishing the friends XSLT stylesheet might encourage a few nibbles.
Finally got this somewhat worthy of publishing! The transform begins by iterating through every clip on the FCP timeline and assigning each source clip to a variable. Variable names are based on clip names but stripped of any non alphanumeric characters. Then, it iterates again and calls on those variables via a myriad of trims. I'm sure there are many more cleaner approaches to doing this, but it's a start, and it works. Of course only simple cuts and fades are supported, but that is enough to be a tremendous time saver for me. In fact, I already put it to use by editing an entire music video in Final Cut off ProRes proxies and then "conforming" the project to Cineform 4:4:4 AVIs using this sheet. Worked like a charm.


<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-function" >
<xsl:output method="text" omit-xml-declaration="yes" />

<xsl:template match="/">

<xsl:for-each select="/xmeml/sequence/media/video/track/clipitem"><xsl:value-of select="translate(name,translate(name,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',''),'')" />=QTInput("<xsl:value-of select="file/name"/>")
</xsl:for-each>

<xsl:for-each select="/xmeml/sequence/media/video/track[1]/clipitem|transitionitem">
<xsl:if test="name()='clipitem'">
<xsl:apply-templates select="." mode="trim"/>
<xsl:apply-templates select="preceding-sibling::*[name()='transitionitem'][alignment='start-black']" mode="fadein"/>
<xsl:if test="name(following-sibling::*)='transitionitem' and following-sibling::*/alignment='end-black'">
<xsl:apply-templates select="following-sibling::transitionitem[1][alignment='end-black']" mode="fadeout"/>
</xsl:if>
<xsl:if test="position() != last()">+</xsl:if>
</xsl:if>
</xsl:for-each>

</xsl:template>
<xsl:template match="clipitem" mode="trim">Trim(<xsl:value-of select="translate(name,translate(name,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',''),'')" />,<xsl:value-of select="in"/>,<xsl:value-of select="out - 1"/>) \
</xsl:template>
<xsl:template match="*" mode="fadein">.FadeIn(<xsl:value-of select="name"/>,<xsl:value-of select="end - start"/>)</xsl:template>
<xsl:template match="*" mode="fadeout">.FadeOut(<xsl:value-of select="name"/>,<xsl:value-of select="end - start"/>)</xsl:template>
</xsl:stylesheet>

chaynik
1st July 2021, 02:10
Bump :)