Hello up till now i have used Megui to encode my avisynth scripts but after writing a few scripts in Vapoursynth i don't know how to start the process of encoding. i have the x265.exe file ready but where do i place it and where am i supposed to put the x265 parameters. i am not familiar with command line encoding. do i use powershell,cmd,vsedit to encode using vapoursynth?. also how would i encode the audio with the video and mux them in mkv?. thanks sorry if these are noob questions.
+ Reply to Thread
Results 1 to 13 of 13
-
-
-
Using and scripting the terminal is not exactly easy, it took me twenty years to master...
Recommendations:
PowerShell, Windows Terminal, VS Code -
example:
Code:import vapoursynth as vs from vapoursynth import core clip = core.lsmas.LibavSMASHSource(r"G:/my_file.mp4") clip = core.resize.Spline36(clip, width=1280, height=720) clip.set_output(0)
Then you proceed to command prompt in windows and apply those three command lines:
Code:"vspipe.exe" --y4m "C:\my_scrit.vpy" - | "x265.exe" --frames 26540 --input-csp i420 --y4m --input-depth 8 --output-depth 10 --input-res 1280x720 --fps 30000/10001 --crf 23 --output "out.265" - "ffmpeg.exe" -i "G:\my_file.mp4" -vn -f wav - | "neroAacEnc.exe" -ignorelength -lc -cbr 256000 -if - -of "C:\my_audio.m4a" "mp4box.exe" -add "C:\out.265:fps=29.970" -add "C:\my_audio.m4a" -new "C:\my_output.mp4"
if not frames x265 might not report status of encoding , how far it is in , at least x264 behavess like that
Vapoursynth does not pass audio in official version, right now they final touch it and test to include it in and hopefully incoming version, right now there are testing builds only to pass audio.Last edited by _Al_; 19th Apr 2020 at 17:03.
-
you can encode h265 right in your script itself. Python is a programming language so you can use its subprocess module.
Like example in here:
https://forum.videohelp.com/threads/392480-Easy-way-to-encode-vpy-scripts#post2544851 -
That reads as you do much manual work that could be avoided with more powerful tools and specialized builds.
-
It does not have to be punched manually all the time. Scripts could be used from basic batch scripts to elaborate UI or your GUI sure.
Not sure if anyone types it like that all the time, it is prone to create mistakes. That is just basic that can be tweaked to something else.
Vapoursynth uses Python so all those commands could be performed in that script as well, making audio and muxing.Last edited by _Al_; 19th Apr 2020 at 17:13.
-
-
Parameters are set in that script. You run that script and you encode h265 video. Name that script *.py, not *.vpy. then to use any Python script editor. Module subprocess.Popen is Python module that comes with Python. Calling that function (subprocess.Popen with your arguments) encodes H265 video.
And stdin (standard input) for that subprocess is vapoursynth clip. It is all done within that script.
Define paths for x265, output, then
Code:x265_cmd = [x265, '--frames', f'{len(clip)}', '--y4m', '--input-depth', f'{clip.format.bits_per_sample}', '--output-depth', '10', '--input-res', f'{clip.width}x{clip.height}', '--fps', f'{clip.fps_num}/{clip.fps_den}', '--crf', '23', '--output', output, '-'] process = subprocess.Popen(x265_cmd, stdin=subprocess.PIPE) clip.output(process.stdin, y4m = True) process.communicate()
Code:x265_cmd = [x265, '--y4m', '--input-depth', f'{clip.format.bits_per_sample}', '--output-depth', '10', '--crf', '23', '--output', output, '-'] process = subprocess.Popen(x265_cmd, stdin=subprocess.PIPE) clip.output(process.stdin, y4m = True) process.communicate()
You can use ffmpeg instead of x265, it does not matter, subprocess does not work only with x265. It works with anything that accepts stdin.
But I'd recommend using vspipe route, it sort of make things more simple. Just make a script and then use vspipe to pipe it into encoder that accepts stdin. (x264, x265, ffmpeg)Last edited by _Al_; 19th Apr 2020 at 22:53.
-
example how you can run mp4box in python script:
Code:MP4BOX= r'C:\tools\Mp4box.exe' output = r'C:\destination\output.mp4' #temp_output is defined somewhere above, for example your temp 265 video #also fps mp4box_cmd = [MP4BOX, '-add' , temp_output+f':fps={fps}', '-par', '1=1:1', '-new', output] process = subprocess.Popen(mp4box_cmd) process.communicate()
Similar Threads
-
Easy way to encode .vpy scripts?
By zanzar in forum Newbie / General discussionsReplies: 22Last Post: 20th Oct 2019, 18:49 -
Encode x264 to x265?
By BlurayHD in forum Video ConversionReplies: 7Last Post: 7th Jan 2019, 08:30 -
Help me pls how to Encode x265 Like This ?
By Ykefas in forum Newbie / General discussionsReplies: 5Last Post: 27th Jan 2018, 09:29 -
encode w/out the 'perception' benefit of x264 and x265
By vhelp in forum Video ConversionReplies: 9Last Post: 7th Nov 2016, 03:45 -
How To Encode x265 Like This ?
By iyanricardo in forum Newbie / General discussionsReplies: 5Last Post: 16th Jul 2016, 11:06