Hey, I'm trying to use AviSynth to trim the audio (while NOT trimming the video).
This is my script so far, but it doesn't make the output any difference than a regular encoding without this script.
By the way, I'm trying to remove the original audio's delay by removing the equivalent from the beginning of the file.
So, if my audio has a delay of 1164ms, I will remove 1.164s from the beginning of the audio and then set StaxRip's audio delay to 0. I do this because my audio gets shorter than the video and the end of the video has no audio because it cuts too soon.
Code:LoadPlugin("C:\Users\aradm\Desktop\Downloads\StaxRip-x64-2.0.2.0-stable\Apps\Plugins\avs\ffms2\ffms2.dll") video=ffvideosource("Gibor.Amiti.S01E20.mkv", colorspace="yv12") audio=ffaudiosource("Gibor.Amiti.S01E20.mkv") fake=blankclip(250) AudioDub(fake,audio) AudioTrim(1.164,0) AudioDub(video,last)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 30
Thread
-
-
How about you try what I told you in the other thread?
Code:LoadPlugin("C:\Users\aradm\Desktop\Downloads\StaxRip-x64-2.0.2.0-stable\Apps\Plugins\avs\ffms2\ffms2.dll") audio=ffaudiosource("Gibor.Amiti.S01E20.mkv") video=ffvideosource("Gibor.Amiti.S01E20.mkv", colorspace="yv12") AudioDub(video, audio) DelayAudio(-1.164) Trim(0, 0)
-
I don't know. Actually I think you might neither need DelayAudio() nor AudioTrim() if you open the mkv directly using ffvideosource+ffaudiosource as this source filter should handle the delays automatically. DelayAudio() is more intended for the case when you demux to raw audio because then the delay info from the mkv is missing.
-
I don't think you understand what I'm after.
My original file has a delay of 1164ms, which gets handled automatically by StaxRip, no problem with that.
I want to REMOVE that delay and encode the file with StaxRip delay of 0ms, so there's no audio cut at the ending.
That's why I need to trim the audio (and not the video), so I can set StaxRip's delay to 0ms and it will be fine. -
Indeed, I don't. How you need to handle delay depends on your source file and source filters. If you have one mkv file and open it with ffvideosource+ffaudiosource you shouldn't need DelayAudio() unless there's a bug or your mkv was async to begin with. Whether or not the latter is the case I cannot possibly know. I suggest you simply try.
-
Try:
Code:audio=ffaudiosource("Gibor.Amiti.S01E20.mkv").DelayAudio(-1.164) video=ffvideosource("Gibor.Amiti.S01E20.mkv", colorspace="yv12") AudioDub(video, audio)
-
-
-
Code:
Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings : CABAC / 3 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 3 frames Codec ID : V_MPEG4/ISO/AVC Duration : 25 min 29 s Bit rate : 9 869 kb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 FPS Standard : Component Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.190 Stream size : 1.76 GiB (99%) Default : Yes Forced : No Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : A_AAC-2 Duration : 25 min 30 s Bit rate : 128 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Delay relative to video : -1 s 164 ms Stream size : 23.4 MiB (1%) Default : Yes Forced : No
-
Don't cut away the top of the log.
Did you try:
Code:audio=ffaudiosource("Gibor.Amiti.S01E20.mkv") video=ffvideosource("Gibor.Amiti.S01E20.mkv", colorspace="yv12") AudioDub(video, audio) Trim(0, 0)
Also try:
Code:audio=ffaudiosource("Gibor.Amiti.S01E20.mkv") video=ffvideosource("Gibor.Amiti.S01E20.mkv", fpsnum=25, fpsden=1, colorspace="yv12") AudioDub(video, audio) Trim(0, 0)
-
-
Did you try it or not? Like I said in post #6 ffvideosource+ffaudiosource work different from what you say.
-
-
-
Open your script in a media player and see if the audio is shifted as expected. Or VirtualDub. It always works for me.
-
I do get even the audio I'm currently using. It's just not trimming, nor applying delay from the script itself (while encoding with StaxRip).
The script itself proved to be working when opened in MPC-HC - it applied a -1.164 delay using DelayAudio(..).
When encoding the same script with StaxRip, it just outputs the file without the specified DelayAudio(..), which means it's just keeping only the original audio delay automatically detected by StaxRip. -
I tried it also on an older version of Staxrip (1.2.2.0). In my log I don't see where it takes the delay into account,
it uses mp4Box to demux the whole audio. Perhaps this is corrected in later versions.
I used delay and trim() and ended up with a file where the video is trimmed but the audio starts from the beginning
The newest versions is such a bloat. Probably better off with Virtualdub2 -
I got it working without an .AVS script.
Just disabled audio demuxing and set audio decoder to FFAudioSource, audio encoder to ffmpeg (wanted to use qaac but didn't seem to give the appropriate results), and then just encoded normally as I always do while keeping the delay set to its default. The output would then be good without the audio being cut at the end. -
-
That is why I suggested loading a completely different audio file in the script in post #23 -- to verify StaxRip was using the audio from the script, not the original audio.
As a side note, the audio and video in an A/V file don't have to start at the same time, have the same length, or end at the same time.
Similar Threads
-
AviSynth: Cropping a specific trim
By smike in forum EditingReplies: 6Last Post: 21st Sep 2017, 16:07 -
Trim problem with AVISynth
By smike in forum EditingReplies: 5Last Post: 9th Aug 2016, 10:20 -
AviSynth Audio Trim Question
By Akai-Shuichi in forum RestorationReplies: 2Last Post: 31st Mar 2016, 19:27 -
Problem with multiple using of 'Trim' filter in Avisynth
By Balbes in forum Video ConversionReplies: 6Last Post: 19th Dec 2015, 08:15 -
avisynth: how trim using for example 0:00:31.040000 ?
By marcorocchini in forum Newbie / General discussionsReplies: 9Last Post: 31st Oct 2014, 16:07