Log in

View Full Version : stackhorizontal


donnje
29th May 2022, 10:45
I use this script to check the different frames between the two videos,

DSS2("C:\Test Mux\ITA.mp4")
DSS2("C:\Test Mux\SPA HD.mp4")
a=DSS2("C:\Test Mux\ITA.mp4")
b=DSS2("C:\Test Mux\SPA HD.mp4").blackmanresize(736,414).assumefps(25)
stackhorizontal(a,b)

I see that the first difference between the two is at frame
19=time 0 ".760 in video A,

https://i.postimg.cc/1RLv3XCP/Screen-Shott1064.jpg

1 - how can I check which frame and time it corresponds to in video B?
if I open a new tab with video B the black frames are from frame 0 to 68 I don't know which one I should take

https://i.postimg.cc/3JqYRXMN/Screen-Shott1065.jpg


2- being the videos already encoded I think I can't work on the video frames but only edit the audio, right?

I hope I explained thanks

Mounir
29th May 2022, 12:05
With a timer for each video that should work no ?

donnje
29th May 2022, 17:14
With a timer for each video that should work no ?

yes great!
have a timer also in the video on the right?

hello_hello
29th May 2022, 20:12
Would this do it?

I added Trim() just as an example so the two videos are out by 2 frames.

StackHorizontal(A.Position().Trim(2,0), B.Position())

Position.zip (https://files.videohelp.com/u/210984/Position.zip)

https://i.postimg.cc/pX5qG0gX/A.jpg

donnje
30th May 2022, 08:31
Would this do it?

I added Trim() just as an example so the two videos are out by 2 frames.

StackHorizontal(A.Position().Trim(2,0), B.Position())

Position.zip (https://files.videohelp.com/u/210984/Position.zip)

https://i.postimg.cc/pX5qG0gX/A.jpg

Thanks a lot, great :)
how should i do to use it? sorry but I'm starting to use Avisynth now
I tried to put the file "Position 2022-02-04.avsi" inside "C:\Program Files (x86)\AviSynth+\plugins+" but it doesn't change anything

kedautinh12
30th May 2022, 10:34
Thanks a lot, great :)
how should i do to use it? sorry but I'm starting to use Avisynth now
I tried to put the file "Position 2022-02-04.avsi" inside "C:\Program Files (x86)\AviSynth+\plugins+" but it doesn't change anything

You need open this file, the scripts inside is what you need to work

donnje
30th May 2022, 11:09
You need open this file, the scripts inside is what you need to work

I open avspmod then paste my script

DSS2("C:\Test Mux\ITA.mkv")
DSS2("C:\Test Mux\SPA HD.mkv")
a=DSS2("C:\Test Mux\ITA.mkv")
b=DSS2("C:\Test Mux\SPA HD.mkv").blackmanresize(736,414).assumefps(25)
stackhorizontal(a,b)

next can you tell me step by step, please?
I thought that with your script you could automatically see all the times of the single frames, is that so?

hello_hello
1st June 2022, 09:00
Scripts with an avsi extension in the Avisynth plugins folder should auto-load when Avisynth runs, along with any plugins (dlls), so as it appears "Position 2022-02-04.avsi" is in the plugins folder the function should automatically load and you'll just need to add Position() to your script where you want to use it.

There's often several ways to do the same thing in Avisynth, but when adding multiple filters I'd probably do something like this to keep it read-able. By the way, you seem to have doubled up on the source filters.

A = DSS2("C:\Test Mux\ITA.mkv")
B = DSS2("C:\Test Mux\SPA HD.mkv")

A = A.Position() # possibly not needed if AvsPmod is displaying frame numbers etc
B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B.Position()

StackHorizontal(A, B)

If you're only wanting the audio from B you can still edit on frame numbers with Trim (rather than use AudioTrim), then when the two videos match you can combine one clip's audio with the other's video. As a simple example, if you need to remove the first 15 frames from clip B to make the videos match and then want to combine clip B's audio with A's video.

A = DSS2("C:\Test Mux\ITA.mkv")
B = DSS2("C:\Test Mux\SPA HD.mkv")

A = A.Position() # possibly not needed if AvsPmod is displaying frame numbers etc
B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B.Position().Trim(15, 0)

C = StackHorizontal(A, B)
D = AudioDub(A, B)

Return D # or C depending on which output you want.

Obviously once you're happy, you'd need to remove Position() from the script for any video you need to encode.

By the way, AssumeFPS() changes the frame rate of the video but doesn't change the audio, so if clip B is originally something other than 25fps, this will cause the video and audio sync to be lost.

B = B.BlackmanResize(736,414).AssumeFPS(25)

I'm not really sure what you're wanting to achieve, but if you need to adjust the video frame rate you can use the AudioSpeed function (https://forum.videohelp.com/threads/384967-AudioSpeed-AudioMeter-AudioWave-scripts) to adjust the audio to match. Once again the script should be in the plugins folder to auto-load the function.
If the original clip B frame rate was 24000/1001 (23.976 fps), this would adjust the audio speed to match the video after speeding it up to 25fps.

B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B..AudioSpeed(25.0, 24000.0/1001.0, Info=true)
B = B.Position()

To correct the audio pitch so it doesn't change.

B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B..AudioSpeed(25.0, 24000.0/1001.0, PitchCorrect=true, Info=true)
B = B.Position()

Another thought.... assuming the two videos are the same but one has more blank frames at the beginning than the other, you can probably match them up with AvsPmod by making a note of the frame numbers on the first scene change for each video. You wouldn't really need the Position function.

If the first scene change happens at frame 128 for clip A, and then according to AvsPmod the same scene change happens at frame 142 for clip B, you'd know you need to remove 142-128 = 14 frames from the beginning of clip B so it matches clip A.

B = B.BlackmanResize(736,414).AssumeFPS(25).Trim(14, 0)

donnje
6th June 2022, 15:47
Scripts with an avsi extension in the Avisynth plugins folder should auto-load when Avisynth runs, along with any plugins (dlls), so as it appears "Position 2022-02-04.avsi" is in the plugins folder the function should automatically load and you'll just need to add Position() to your script where you want to use it.

There's often several ways to do the same thing in Avisynth, but when adding multiple filters I'd probably do something like this to keep it read-able. By the way, you seem to have doubled up on the source filters.

A = DSS2("C:\Test Mux\ITA.mkv")
B = DSS2("C:\Test Mux\SPA HD.mkv")

A = A.Position() # possibly not needed if AvsPmod is displaying frame numbers etc
B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B.Position()

StackHorizontal(A, B)

If you're only wanting the audio from B you can still edit on frame numbers with Trim (rather than use AudioTrim), then when the two videos match you can combine one clip's audio with the other's video. As a simple example, if you need to remove the first 15 frames from clip B to make the videos match and then want to combine clip B's audio with A's video.

A = DSS2("C:\Test Mux\ITA.mkv")
B = DSS2("C:\Test Mux\SPA HD.mkv")

A = A.Position() # possibly not needed if AvsPmod is displaying frame numbers etc
B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B.Position().Trim(15, 0)

C = StackHorizontal(A, B)
D = AudioDub(A, B)

Return D # or C depending on which output you want.

Obviously once you're happy, you'd need to remove Position() from the script for any video you need to encode.

By the way, AssumeFPS() changes the frame rate of the video but doesn't change the audio, so if clip B is originally something other than 25fps, this will cause the video and audio sync to be lost.

B = B.BlackmanResize(736,414).AssumeFPS(25)

I'm not really sure what you're wanting to achieve, but if you need to adjust the video frame rate you can use the AudioSpeed function (https://forum.videohelp.com/threads/384967-AudioSpeed-AudioMeter-AudioWave-scripts) to adjust the audio to match. Once again the script should be in the plugins folder to auto-load the function.
If the original clip B frame rate was 24000/1001 (23.976 fps), this would adjust the audio speed to match the video after speeding it up to 25fps.



To correct the audio pitch so it doesn't change.



Another thought.... assuming the two videos are the same but one has more blank frames at the beginning than the other, you can probably match them up with AvsPmod by making a note of the frame numbers on the first scene change for each video. You wouldn't really need the Position function.

If the first scene change happens at frame 128 for clip A, and then according to AvsPmod the same scene change happens at frame 142 for clip B, you'd know you need to remove 142-128 = 14 frames from the beginning of clip B so it matches clip A.

B = B.BlackmanResize(736,414).AssumeFPS(25).Trim(14, 0)

I send you a pm :)
I should keep audio 1 and having two videos already encoded you will have to mark the different frames and the time and then go and edit the audio with another app,
I have copied into

C:\Program Files (x86)\AviSynth+\plugins64


but if I write the script

A = DSS2("C:\Test Mux\ITA.mkv")
B = DSS2("C:\Test Mux\SPA HD.mkv")
B = B.BlackmanResize(736,414).AssumeFPS(25)
B = B.Position()
StackHorizontal(A, B)

I have this error

https://i.postimg.cc/X7V8qTF9/Screen-Shott1083.jpg

poisondeathray
6th June 2022, 15:49
showframenumber()
showtime()


a=DSS2("C:\Test Mux\ITA.mkv").showframenumber().showtime()
b=DSS2("C:\Test Mux\SPA HD.mkv").blackmanresize(736,414).assumefps(25).showframenumber().showtime()
stackhorizontal(a,b)


http://avisynth.nl/index.php/ShowFrameNumber#ShowFrameNumber
http://avisynth.nl/index.php/ShowFrameNumber#ShowTime

donnje
6th June 2022, 16:10
showframenumber()
showtime()


a=DSS2("C:\Test Mux\ITA.mkv").showframenumber().showtime()
b=DSS2("C:\Test Mux\SPA HD.mkv").blackmanresize(736,414).assumefps(25).showframenumber().showtime()
stackhorizontal(a,b)


http://avisynth.nl/index.php/ShowFrameNumber#ShowFrameNumber
http://avisynth.nl/index.php/ShowFrameNumber#ShowTime

perfect now you see them, but I think it is not working correctly on both videos I see the same time and the same frame but these are different
https://i.postimg.cc/k48SY4dk/Screen-Shott1081.jpg

poisondeathray
6th June 2022, 16:48
Use Trim to align them


I see that the first difference between the two is at frame
19=time 0 ".760 in video A,

if I open a new tab with video B the black frames are from frame 0 to 68 I don't know which one I should take

Open 2 tabs in avspmod, when the 1st frame aligns use that trim number . It should be somewhere around 69-19=50 for B . It's easier to go to the 1st good frame on both versions, because a "black" frame looks the same

So if "A" starts with black frames and around frame 19 with the fade in frame, and "B" starts with black and around frame 69 for the same fade in frame (if 68 is the last black frame),


a=DSS2("C:\Test Mux\ITA.mkv").showframenumber().showtime()
b=DSS2("C:\Test Mux\SPA HD.mkv").blackmanresize(736,414).assumefps(25).trim(50,0).showframenumber().showtime()
stackhorizontal(a,b)


You actually don't need showframenumber or showtime , you can do it with tabs only . Where you call showframenumber/showtime, alters the values. e.g. if you apply trim before, the new framenumber and time are reflected because they are called after