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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th September 2021, 01:23   #121  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 218
testing about these, so it might help someone
API4 audio_test.py script:
Code:
import vapoursynth as vs
from vapoursynth import core
source_path=r"video.mp4" #stereo audio
v = core.lsmas.LibavSMASHSource(source_path)
a = core.bas.Source(source_path)
v.set_output(0)
a.set_output(1)
some line here are taken from somewhere else from this forum:
Code:
AUDIO
VSPipe -o 1 -c wav audio_tests.py - | neroAacEnc -ignorelength -lc -cbr 96000 -if - -of nero.m4a
VSPipe -o 1 -c wav audio_tests.py - | ffmpeg -y  -i - ffmpeg_output.wav
VSPipe -o 1        audio_tests.py - | ffmpeg -y -f f32le -ac 2 -ar 48000 -i - ffmpeg_output.wav
VSPipe -o 1 -c wav audio_tests.py  vspipe_to_wav.wav   #but double size (32bit if original is 16bit)
VSPipe -o 1        audio_tests.py  vspipe_to_wav.wav   #but double size (32bit if original is 16bit)
VSPipe -o 1 -c wav audio_tests.py - | ffplay -
VSPipe -o 1        audio_tests.py - | ffplay -f f32le -ac 2 -ar 48000 -i -
VSPipe -o 1 -c wav audio_tests.py - | ffmpeg -i video.mp4 -i - -map 0:0 -map 1:0 -f AVI -c:v utvideo -pix_fmt yuv420p -colorspace bt709 -c:a pcm_s16le -y ffmpeg_utvideo.avi

VIDEO
VSPipe -o 0 -c y4m audio_tests.py - | ffplay -i -
VSPipe -o 0 -c y4m audio_tests.py - | mpv -
btw. can be two nodes (vnode,anode) piped into ffmpeg or ffplay in one line?

Last edited by _Al_; 10th September 2021 at 01:37.
_Al_ is offline   Reply With Quote
Old 10th September 2021, 09:08   #122  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
No, to do that vspipe needs to wrap the streams into a more complex container like mkv.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 10th September 2021, 09:55   #123  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by _Al_ View Post
All working here so far, this is nice.
Also attempt to drag audio along with video, here in vapoursynth attaching audio to video frames using props.
But the code below does not work because ModifyFrame does not work with anode. vnode only. ModifyFrame (or FrameEval) is planned in future or is it a bad idea?

oh I see, n is not the same for vnode as is for anode, this could not work, only if bunch of anode frames (perhaps list) is attached to vnode and then reconstructed again, no idea how anisynth does it,

also deleting previous code to not confuse anyone
Frame props are nonsensical since audio frames are a very arbitrary thing. That's why I haven't really exposed the manipulation and I want audio support to mostly allow you to pass audio through in a convenient way.

I think what you should do it simply create wrapper functions for the trim, splice and other reorder functions and use those. Most filters don't reorder the clip. That would be my first attempt. I'll write an example some day of it.

Avisynth has a weird symbiotic relationship between one audio track and one video track. Have more than one audio track and things get iffy.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 10th September 2021, 15:45   #124  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,630
you can attach audio frame(s), possibly audio frames from multiple audio tracks, to a video frame using the C++ API, it should be no more complicated than
Code:
auto [PictureFrame, EngAudioFrame, FrenchAudioFrame] = Node::AcquireFrameGiven(Index, GeneratorContex).From(Video, EngAudio, FrenchAudio);
auto CompositeFrame = Core.CopyFrameFrom(PictureFrame);
CompositeFrame["_Audio"] += EngAudioFrame;
CompositeFrame["_Audio"] += FrenchAudioFrame;

Last edited by feisty2; 10th September 2021 at 15:47.
feisty2 is offline   Reply With Quote
Old 13th September 2021, 17:49   #125  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
R55-API4-RC4

Changes:
  • Fixes the expr issue causing weird values
  • Fixes lots of vfw and avfs bugs that snuck into RC3
  • No longer bundles any filters at all
  • Comes with a working vsrepo to help you with the previous point
  • Has a half-reworked documentation with a new theme
  • AverageFrames is now a core function

Will release an api3 build too with the expr and vsrepo fixes if it's working here.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 14th September 2021, 04:46   #126  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,189
The expr issue seems to be fixed, MDSI produces normal scores.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 22nd September 2021, 01:34   #127  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 39
How does VSFilterDependency help? If I invoke another filter to get a vnode, should I also include it in the dependency list for filter creation?
Yomiko is offline   Reply With Quote
Old 22nd September 2021, 07:38   #128  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by Yomiko View Post
How does VSFilterDependency help? If I invoke another filter to get a vnode, should I also include it in the dependency list for filter creation?
If your filter requests frames from the node it should be in the list. Simple rule.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Reply

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 00:04.


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