Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd March 2018, 07:50   #1  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
how to get avisynth to read sony xdavc-L file?

how to get avisynth to read sony xdavc-L file?

currently i'm trying with:

FFMpegSource("H:\video\A011C026_180312ZU.MXF")

and get "video codec not found" error. i think the sony format is h264, though, that FFMpeg reads with no problems. and further, i CAN get FFmpeg to read/convert it.

and if/when i get it to read the file, how to apply a LUT to it. again - one can do this in FFmpeg...
zdoe is offline   Reply With Quote
Old 23rd March 2018, 10:46   #2  |  Link
Yanak
Registered User
 
Join Date: Oct 2011
Posts: 200
Hello,

With a basic file using this profile in Vegas for rendering : Sony MXF HD EX 1280x720 60fps and avisynth+ x64 ( cannot guarantee for other versions )

FFVideoSource works for the video
Code:
LoadPlugin("H:\Plugins\ffms2.dll")
FFVideoSource("H:\test.mxf", colorspace = "YUV420P8")
or
Code:
LoadPlugin("H:\Plugins\ffms2.dll")
FFVideoSource("H:\test.mxf", colorspace = "YUV420P8", cachefile = "H:\TEMP\test.mxf.ffindex")
DDS2 works too :
Code:
LoadPlugin("H:\Plugins\DSS2.dll")
DSS2("H:\test.mxf")
And also LWLibavVideoSource :
Code:
LoadPlugin("H:\Plugins\LSMASHSource.dll")
LWLibavVideoSource("H:\test.mxf", format = "YUV420P8")
This said i have issues with XMF in 4:2:2 10 Bits and some others less common rendering profiles.

As for applying 3DLut's this isn't possible sadly with avisynth as far as i now, something i searched for long without success, would love to see avisytnh support either 3DLuts like .cube or simply be able to apply some haldclut's but i don't have much hope to see this possible one day sadly :/

Edit for video + audio :
Code:
LoadPlugin("H:\Plugins\ffms2.dll")
AudioDub( FFVideoSource("H:\test.mxf", colorspace = "YUV420P8"), FFAudioSource("H:\test.mxf") )
Or :
Code:
LoadPlugin("H:\Plugins\ffms2.dll")
video = FFVideoSource("H:\test.mxf", colorspace = "YUV420P8")
audio= FFAudioSource("H:\test.mxf")
return AudioDub(video, audio)

Last edited by Yanak; 23rd March 2018 at 11:06.
Yanak is offline   Reply With Quote
Old 23rd March 2018, 15:55   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,358
What version of ffms2 are you using ?

vapoursynth has a timecube filter that can apply cube LUTS , but it hasn't been ported to avisynth. You can make a request
https://github.com/sekrit-twc/timecube
https://forum.doom9.org/showthread.php?t=173361
poisondeathray is offline   Reply With Quote
Old 23rd March 2018, 16:10   #4  |  Link
Yanak
Registered User
 
Join Date: Oct 2011
Posts: 200
Hi,

I use the one shipped with Staxrip, should be this one, 2.23.1 : https://github.com/FFMS/ffms2/releases

I saw in vapoursynth documentation that is supported some LUT's when i was searching for this long time ago but not using vapoursynth i did not pursue in this direction, thanks for the links, I'll try to do a request in the forum thread you linked and see how it goes , this will be really neat if possible with avisynth, have nothing to loose asking

Thank you
Yanak is offline   Reply With Quote
Old 23rd March 2018, 16:21   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,358
Quote:
Originally Posted by Yanak View Post
Hi,

I use the one shipped with Staxrip, should be this one, 2.23.1 : https://github.com/FFMS/ffms2/releases
I was asking the OP. He was getting "video codec not found" error

Usually MXF indicates the "prosumer" version, not the consumer variant. This means uncompressed audio and 10bit422 . I suspect the ffms2 he is using is older
poisondeathray is offline   Reply With Quote
Old 23rd March 2018, 16:43   #6  |  Link
Yanak
Registered User
 
Join Date: Oct 2011
Posts: 200
I suspected it

with rendered 10 bits 422 i had issues, didn't went too far in testing so maybe something is possible or issue was on my end maybe.

Don't know for original files in this format, did not searched for samples.
Yanak is offline   Reply With Quote
Old 23rd March 2018, 17:10   #7  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 937
Well, if 'FFmpegSource' as the function name is actually doing something and throwing error messages about video codecs (rather than AviSynth complaining that the function doesn't exist), that's a huge blinking red sign that the version is from the old 1.x series. Not even FFMS2.
qyot27 is offline   Reply With Quote
Old 24th March 2018, 05:26   #8  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
ffms2 - file date 12/29/2016

Quote:
Originally Posted by qyot27 View Post
Well, if 'FFmpegSource' as the function name is actually doing something and throwing error messages about video codecs (rather than AviSynth complaining that the function doesn't exist), that's a huge blinking red sign that the version is from the old 1.x series. Not even FFMS2.
ffms2 - file date 12/29/2016. that's what i found by googling for it. though version number is not apparent, it likely is the same one as linked to on some answers above.

where to get the later version if there is one?

and yes, i have the
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\ffms2.dll")
line on the .AVS script.

the problem was that my command was FFMpegSource NOT FFvideoSource.

had gotten that somewhere when googled for it. now the clip loads.

but yes, i would really need LUT so that i don't have to do a 2nd pass with FFmpeg. i guess out of luck there...
zdoe is offline   Reply With Quote
Old 24th March 2018, 06:10   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,358
vapoursynth; yanak already requested the port . You can even load avs scripts in vapoursynth

what type of lut ? there is an old plugin ddcc by tritical for avisynth, but it uses a different type of 3DLUT, not the commonly used cube or 3dl . It might be possible to do some conversion



What is the background information ? What is the 2nd pass in ffmpeg (why can't 1pass be the final pass) ? What is the final format goal ? What are you doing in avisynth and after ?
poisondeathray is offline   Reply With Quote
Old 24th March 2018, 07:26   #10  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
Quote:
Originally Posted by poisondeathray View Post
what type of lut ? there is an old plugin ddcc by tritical for avisynth, but it uses a different type of 3DLUT, not the commonly used cube or 3dl . It might be possible to do some conversion

What is the background information ? What is the 2nd pass in ffmpeg (why can't 1pass be the final pass) ? What is the final format goal ? What are you doing in avisynth and after ?
the LUT i need is SLog3SGamut3CineToLC-709.cube, provided by sony - in short, make low-con material have normal contrast.

but would like to resize, auto-Levels/Gain and stabilize in avisynth before.

i'm not the guy to do a port from some other LUT - i trust way too involved for me.

2nd pass would be to just to apply the LUT... but i guess i CAN feed FFMpeg with the .AVS if i figure out the right command line.

this is an ongoing/developing concern for such footage, but for now i just want to view dailies from manageable-size proxy files - h265 / 1080 instead of the 4k that the cam shoots.

Last edited by zdoe; 24th March 2018 at 07:29.
zdoe is offline   Reply With Quote
Old 24th March 2018, 09:51   #11  |  Link
Yanak
Registered User
 
Join Date: Oct 2011
Posts: 200
Hello,

You can feed FFMpeg with the avs script and apply the LUT, something like this:

The avs script (+ the filters you need/want):
Code:
LoadPlugin("H:\Plugins\ffms2.dll")
video = FFVideoSource("H:\test.mxf", colorspace = "YUV420P8")
audio= FFAudioSource("H:\test.mxf")
return AudioDub(video, audio)
FFMpeg windows cmd line will be something like this:
Code:
ffmpeg -hide_banner -i "H:\script.avs" -filter_complex lut3d="H\\:/LUTs/CineStyle\ S\ Curve.cube" -c:v libx264 -preset slow -crf 18 -c:a copy output.mkv
The encoding parameters and codec needs to be adjusted to your needs, here the audio is just copied and muxed for example.

You will notice the weird path name for the LUT location in the command above, my LUT applied to the script is located here on my machine:
Code:
"H:\LUTs\CineStyle S Curve.cube"
FFmpeg is a complete pain in the rear for paths having spaces or special characters in them that need to be escaped inside filters, in the end my path ends up like this in the windows command prompt :
Code:
"H\\:/LUTs/CineStyle\ S\ Curve.cube"
i strongly recommend having your files in folders that don't require spaces in paths to avoid long headaches trying to get FFmpeg reach them...

The FFmpeg encoding parameters and codec need to be adjusted to your needs ( and maybe refined for the colorspaces used ) but hopefully this helps a bit

Last edited by Yanak; 24th March 2018 at 09:57.
Yanak is offline   Reply With Quote
Old 24th March 2018, 15:58   #12  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,358
Quote:
Originally Posted by zdoe View Post
this is an ongoing/developing concern for such footage, but for now i just want to view dailies from manageable-size proxy files - h265 / 1080 instead of the 4k that the cam shoots.

but would like to resize, auto-Levels/Gain and stabilize in avisynth before.
might be ok for proxies... But when you get to the "ongoing/developing concern" part - be careful about the manipulations you do. Some of the filters might be 8bit, you didn't mention which ones specifically. You need at least 10bit or more to get the most out of slog3

Also, auto-levels/ gain before the LUT application might be problematic. slog is flat . If you "auto" contrast it before, that sort of messes everything up

Quote:
i'm not the guy to do a port from some other LUT - i trust way too involved for me.
I wasn't asking you to do it I was suggesting you can use vapoursynth
poisondeathray is offline   Reply With Quote
Old 25th March 2018, 18:11   #13  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
Quote:
Originally Posted by poisondeathray View Post
might be ok for proxies... But when you get to the "ongoing/developing concern" part - be careful about the manipulations you do. Some of the filters might be 8bit, you didn't mention which ones specifically. You need at least 10bit or more to get the most out of slog3

Also, auto-levels/ gain before the LUT application might be problematic. slog is flat . If you "auto" contrast it before, that sort of messes everything up

I wasn't asking you to do it I was suggesting you can use vapoursynth
yeah - i've yet to get into sophistication of color space accuracy. xdavc is 4:2:2 10 bit.

currently i have FFmpeg command line as:
"C:\Program Files (x86)\FFmpeg\ffmpeg.exe" -threads 1 -i "H:\03-12\MXFautoadjustDepan.AVS" -vf lut3d="SLog3SGamut3CineToLC-709.cube" -c:v libx265 -preset fast -b:v 1600k -c:a aac -b:a 128k -metadata:s:a:0 lang=en output265.mkv

and .AVS:
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\ffms2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\AutoAdjust.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\depanestimate.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\depan.dll")

FFvideoSource("H:\03-12\video\A010C059_1803129F.MXF")
Lanczos4Resize(1920,1080)
i = ConvertToYV12(matrix="rec709")
mdata = DePanEstimate(i)
vectors=MSuper().MAnalyse(isb=false,blksize=8, overlap=0,search=5) globalmotion=MDepan(vectors,pixaspect=1,thSCD1=500)
DePanStabilize(i, data=mdata)
AutoAdjust(auto_gain=true, auto_balance=true)

this works for the video, but audio tracks are empty. how to have the audio carry over?

i tried:
video = FFVideoSource("H:\test.mxf", colorspace = "YUV420P8")
audio= FFAudioSource("H:\test.mxf")
return AudioDub(video, audio)

and get an error message from the resize filter.

and yes, i can see where auto-contrast would be problematic for slog footage. the output looks pretty good though.

once i figure out the audio part, what i need is a way to do this for all files in a directory recursively... probably doable, but variables in a batch file are kinda challenging.
zdoe is offline   Reply With Quote
Old 25th March 2018, 18:23   #14  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,358
To load the audio, it depends on the audio configuration . You have to load each track with FFAudioSource, and specify the track number. You can use mergechannels() to send them or you might want to down mix them to stereo since it looks like you're using 2ch aac

For example 4channel mono
Code:
FFVideoSource("blah.mxf")
#whatever video filters here, depan etc...
vid=last

aud1=FFAudioSource("blah.mxf", track=1)
aud2=FFAudioSource("blah.mxf", track=2)
aud3=FFAudioSource("blah.mxf", track=3)
aud4=FFAudioSource("blah.mxf", track=4)

aud=mergechannels(aud1,aud2,aud3,aud4)
audiodub(vid,aud)
If you send 4ch in the avs script, you can also use -map in ffmepg to select specific channels

Yes, it's possible to do recursive subfolders with ffmpeg batch . There are some examples posted at videohelp.com and I think here too
poisondeathray is offline   Reply With Quote
Old 25th March 2018, 19:45   #15  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 937
Code:
FFmpegSource2("title.mxf",atrack=-1)
You might want to use ffmsindex to do the indexing separately, if the file's too big to do quickly:
Code:
ffmsindex -t -1 title.mxf
qyot27 is offline   Reply With Quote
Old 26th March 2018, 08:25   #16  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
Quote:
Originally Posted by poisondeathray View Post
To load the audio, it depends on the audio configuration . You have to load each track with FFAudioSource, and specify the track number. You can use mergechannels() to send them or you might want to down mix them to stereo since it looks like you're using 2ch aac

For example 4channel mono
Code:
FFVideoSource("blah.mxf")
#whatever video filters here, depan etc...
vid=last

aud1=FFAudioSource("blah.mxf", track=1)
aud2=FFAudioSource("blah.mxf", track=2)
aud3=FFAudioSource("blah.mxf", track=3)
aud4=FFAudioSource("blah.mxf", track=4)

aud=mergechannels(aud1,aud2,aud3,aud4)
audiodub(vid,aud)
If you send 4ch in the avs script, you can also use -map in ffmepg to select specific channels

Yes, it's possible to do recursive subfolders with ffmpeg batch . There are some examples posted at videohelp.com and I think here too
great - it works! yes, i'd like only one stereo track on the result. e.g. channel 1 clean, channels 2,3 mixed together, drop channel 4.

the mergechannels above seems to NOT merge, but to somehow bundle the tracks together.

as for the recursive batch - does avisynth do variables?
zdoe is offline   Reply With Quote
Old 26th March 2018, 09:39   #17  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
Quote:
Originally Posted by qyot27 View Post
Code:
FFmpegSource2("title.mxf",atrack=-1)
You might want to use ffmsindex to do the indexing separately, if the file's too big to do quickly:
Code:
ffmsindex -t -1 title.mxf
is there a way to define multiple tracks in "atrack?" i got 4 in the source, and need at least 2 in the target?

otherwise i'll have to do FFvideo/FFaudio -Source, but that needs multiple references to the source file - which worries me because of the ultimate result - recursion.

indexing time doesn't worry me that much - the batch can run overnight if i get it to work.
zdoe is offline   Reply With Quote
Old 26th March 2018, 10:41   #18  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 937
The atrack parameter is for discrete audio tracks. You have to use MixAudio for downmixing.

Last edited by qyot27; 27th March 2018 at 00:30. Reason: Tracks, not channels.
qyot27 is offline   Reply With Quote
Old 26th March 2018, 12:05   #19  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
Quote:
Originally Posted by qyot27 View Post
The atrack parameter is for discrete audio channels. You have to use MixAudio for downmixing.
atrack - can pull only one audio channel, right?

anyway, now i have:

aud1=FFAudioSource("H:\03-12\video\A011C001_1803129K.MXF", track=1)
aud2=FFAudioSource("H:\03-12\video\A011C001_1803129K.MXF", track=2)
aud3=FFAudioSource("H:\03-12\video\A011C001_1803129K.MXF", track=3)

audR=MixAudio(aud2, aud3, 0.75, 0.075)

aud=mergechannels(aud1,audR)
audiodub(vid,aud)

and it works, though i'm not sure what i should do with the level-parameters.
zdoe is offline   Reply With Quote
Old 27th March 2018, 11:24   #20  |  Link
zdoe
Registered User
 
Join Date: Mar 2018
Posts: 9
ok - i'm getting close, i think, but still errors

avs:
Code:
SetWorkingDir("C:\Program Files (x86)\AviSynth\plugins\")
LoadPlugin("ffms2.dll")
LoadPlugin("AutoAdjust.dll")
LoadPlugin("depanestimate.dll")
LoadPlugin("depan.dll")
LoadPlugin("GetSystemEnv.dll")

BlankClip()
zname=GetSystemEnv("zname")
subtitle(getsystemenv("zname"))
FFvideoSource(zname)

Lanczos4Resize(1920,1080)
i = ConvertToYV12(matrix="rec709")
mdata = DePanEstimate(i)
vectors=MSuper().MAnalyse(isb=false,blksize=8, overlap=0,search=5) globalmotion=MDepan(vectors,pixaspect=1,thSCD1=500) 
DePanStabilize(i, data=mdata)
AutoAdjust(auto_gain=true, auto_balance=true)

vid=last

aud1=FFAudioSource("H:\economist-03-12\video\A011C001_1803129K.MXF", track=1)
aud2=FFAudioSource("H:\economist-03-12\video\A011C001_1803129K.MXF", track=2)
aud3=FFAudioSource("H:\economist-03-12\video\A011C001_1803129K.MXF", track=3)

audR=MixAudio(aud2, aud3, 0.75, 0.075)

aud=mergechannels(aud1,audR)
audiodub(vid,aud)
bat:
Code:
for /r %%f in (\video\*) do (
set zname=h:\video\%%~nxf
:: timeout 1
goto ffcommand
)

:ffcommand
"C:\Program Files (x86)\FFmpeg\ffmpeg.exe" -threads 1 -i "H:\03-12\callsavariable.AVS" -vf lut3d="SLog3SGamut3CineToLC-709.cube" -c:v libx265 -preset fast -b:v 1600k -c:a aac -b:a 128k -metadata:s:a:0 lang=en
pause
goto end

:end
set
pause
error message running the .bat:
Trailing options were found on the commandline.
[avisynth @ 00168460] FFVideoSource: Can't open 'h:\video\A011C001_1803129K.MXF'

(H:\03-12\callsavariable.AVS, line 11)
H:\03-12\callsavariable.AVS: Unknown error occurred

e.g. even though the .AVS can read the variable if run on its own, when used in a batch it doesn't.

"Trailing options were found on the commandline." i assume is caused by the fact that target file is not defined for ffmpeg.

all hail to GetSystemEnv author @stickboy, by the way.
zdoe is offline   Reply With Quote
Reply

Tags
avisynth, ffmpegsource, h265, sony, xdavc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.