Log in

View Full Version : Automatically crop to 1920x1080i XDCAM with ffmpeg


FranceBB
29th December 2017, 23:39
Hi,
on my personal computer I generally use Avisynth to do all sort of post-processing and serve a 1920x1080i PAL 25fps video to ffmpeg to encode it as XDCAM 50 Mbit/s.
Unfortunately, at work we use Vantage to transcode, but it fails with some files.
I'm not allowed to install Avisynth, except in a standalone box.
(I can't always transfer files to that computer via Hard Drive, encode them with Avisynth and then transfer them back).
I'm however allowed to put ffmpeg.exe on every computer, 'cause it's portable.
Anyway, I'd like to use ffmpeg "automatically".
Let me get this straight.
I'd like ffmpeg to resize and crop files to 1920x1080i PAL 25fps, using Lanczos as resizer and make 8 mono audio tracks.
So far, I tried with this, but it doesn't crop automatically and it doesn't create 8 mono audio tracks.
I'd also like it to do frame rate conversion with blending.

ffmpeg.exe -i "test.mp4" -pix_fmt yuv422p -vcodec mpeg2video -vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" -vf yadif=1:tff,scale=w=1920:h=1080:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:sws_dither=0:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,interlace -s 1920:1080 -aspect 16:9 -vf setfield=tff -flags +ildct+ilme -r 25 -b:v 50000k -minrate 50000k -maxrate 50000k -bufsize 36408333 -acodec pcm_s16le -ar 48000 -g 12 -bf 2 -profile:v 0 -level:v 2 -color_range 1 -color_primaries 1 -color_trc 1 -colorspace 1 -f mxf "output.mxf"

My target is XDCAM, so 4:2:2 yv16, 8bit, MPEG-2, closed GOP M=3, N=12, 50 Mbit/s, range limited, BT709, interlaced, TFF, 25fps PAL, with 8 mono PCM audio channels.

ChaosKing
29th December 2017, 23:56
Virtualdub for example works with Avisynth as "portable" if you copy the avisynth dll in the same folder as the vdub exe (or in PATH). I think this should work with other tools too.

Or try this https://forum.doom9.org/showthread.php?t=172124

FranceBB
30th December 2017, 00:42
Looks like Avisynth Universal Installer needs administrator rights

https://i.imgur.com/uhlglWW.png

I tried to put Avisynth.dll and devil.dll in the VirtualDub folder.
Then, I tried to run a very simple script:

LoadPlugin("C:\Users\bucciantinif\Desktop\VirtualDub\plugins\DirectShowSource.dll")
DirectShowSource("test.mp4")

Doesn't work.

https://i.imgur.com/OnQKA6O.png

It would be good to have Avisynth portable, but I guess it's not that easy. Link (https://forum.videohelp.com/threads/381248-portable-avisynth)


EDIT: I managed to make it work.

Ok, so now I basically have Avisynth. Cool.

Is there a way to specify the Avisynth autoload directory without adding a reg file?

For the moment, problem solved like this:


LoadPlugin("C:\Encoding\plugins\ffms2.dll")
video=FFVideoSource("test.mp4")
audio=FFAudioSource("test.mp4")
AudioDub(video, audio)


ResampleAudio(48000)
Normalize(0.89)
Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)

ConvertFPS(50)
Spline64Resize(1920, 1080)
assumeTFF()
separatefields()
selectevery(4,0,3)
weave()
Converttoyv16(interlaced=true)

ChaosKing
30th December 2017, 09:32
Yes, there is AddAutoloadDir(). More info here http://avisynth.nl/index.php/AviSynth%2B