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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st January 2014, 20:26   #1  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Crazy Stupid Question - Can it be done? (Subject:60p->30p)

Ok so I have a really crazy idea; Well some of you will probably think its crazy, but let me explain... No, there is too much, let me sum up....


So there is a trick on Youtube, where you can get "Fake" 60fps playback by using their HTML5 player, which has a playback speed option.

Basically what you do is you take a 60fps clip and stretch it out to a 30fps clip.. It also involves taking the original audio and running it through Audacity to do some time and pitch adjustment.

I'm wondering, if its possible to accomplish this without that "playback" stage. And also, if there is a better way to get cleaner audio.

Let's say I have a 60fps game recording that is 20 minutes long. I want to re-encode it as a 30fps clip that plays back with the temporal resolution of a 60fps clip. Without having to use the whole "playback at 30fps at 2x speed" trick in the first place.

Ideally produce a 20 minute 30 fps clip, which on the timeline is playing back 2x as fast, but is still 20 minutes long. Potentially that could remove the need to fuss with the audio as well.

Is this event remotely possible in theory? With Avisynth, or with Sony Vegas, without any expensive special plugins?

I mean if people can put slow motion clips into regular video clips - can't you put fast-motion clips as well? Meaning, you're not dropping any frames or interpolating or doing anything funny.. You're just playing back the same number of frames at a higher speed. It would seem to make sense that if you can take a given 30fps video, and it has a slow-motion segment in it, that is extremely smooth and looks fine. Could you not also produce a 30fps video from a 60fps source, that plays back at the 60fps rate?

For anyone wondering what this actually looks like, here is a video I uploaded a while ago, after trying the "trick" myself. You must have HTML5 player enabled, so you can select 2x playback speed on the video.
Ace Combat: Assault Horizon - 60fps Test

Last edited by osgZach; 21st January 2014 at 20:30.
osgZach is offline   Reply With Quote
Old 21st January 2014, 20:42   #2  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,418
Why, you can do 60fps playback on the PC natively? Why go through the trouble?
Stereodude is offline   Reply With Quote
Old 21st January 2014, 21:55   #3  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
I am not sure I understand, exactly, but how about using:

Code:
v = AssumeFPS(framerate() / 2.0)
a = TimeStretch(tempo=50.0)

AudioDub(v,a)
You will want to play with the TimeStretch parameters (and I am still not sure this will give you the quality you are looking for) but it should do what you want to do, if I understand you correctly.

EDIT: Re-reading your post, it seems I may not not understand at all But I will leave the snippet above for others who want to use it (or something like it) for the YouTube "trick".

Last edited by vampiredom; 21st January 2014 at 21:59.
vampiredom is offline   Reply With Quote
Old 21st January 2014, 23:06   #4  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Quote:
Originally Posted by Stereodude View Post
Why, you can do 60fps playback on the PC natively? Why go through the trouble?
Because youtube will re-encode 60fps clips to 30fps
osgZach is offline   Reply With Quote
Old 21st January 2014, 23:12   #5  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Quote:
Originally Posted by vampiredom View Post
I am not sure I understand, exactly, but how about using:

Code:
v = AssumeFPS(framerate() / 2.0)
a = TimeStretch(tempo=50.0)

AudioDub(v,a)
You will want to play with the TimeStretch parameters (and I am still not sure this will give you the quality you are looking for) but it should do what you want to do, if I understand you correctly.

EDIT: Re-reading your post, it seems I may not not understand at all But I will leave the snippet above for others who want to use it (or something like it) for the YouTube "trick".
That's the thing.. I want to do the Youtube trick, without the youtube part.

I.e the clip I posted a link to? It plays at the "proper" speed when you increase the playback rate to 2x. Because all Youtube clips are converted to 30fps if they are not already 30fps. You'll notice the timer on Youtube says the clip is almost an hour long - but its actually only about half an hour. Because it was stretched out and slowed down as a 30fps clip.. So that it would play back at 60fps when you increase the speed to 2x in the Youtube player.

I want to get the same playback affect, without the Youtube player part. I.e Create a 30fps clip that plays back with the temporal resolution of the original 60fps clip. Which it basically does because it still has the same number of frames that the 60fps source had.

I'm guessing this could be accomplished in MKV possibly with the use of Timecodes or something.. But that wouldn't address the Audio, and ultimately the real reason for wanting to do it. Which is to upload it to Youtube in the first place. Without requiring the HTML5 player, or special tags to remind people to increase their playback speed, etc..

I found the original video I watched to learn how to do the Youtube trick, so maybe it will explain things better.
https://www.youtube.com/watch?v=EsBXYHfYgmI

So essentially the I would like to find out if its possible to accomplish the end result of what this process does. Without having to rely on a "2x" playback speed of a video player.

Last edited by osgZach; 21st January 2014 at 23:41.
osgZach is offline   Reply With Quote
Old 22nd January 2014, 00:50   #6  |  Link
DarkSpace
Registered User
 
Join Date: Oct 2011
Posts: 204
Quote:
Originally Posted by osgZach View Post
So essentially the I would like to find out if its possible to accomplish the end result of what this process does. Without having to rely on a "2x" playback speed of a video player.
No.
You want all of the following:
- All the frames unaltered.
- The video played at the correct speed.
- The frame rate of the video halved.

This is impossible, you'd have to sacrifice at least one of the 3 points (currently you sacrifice the "correct speed" point, because you rely on the player playing back at 2x speed).

That said, the easiest way to achieve what you've currently got is this:
Code:
OV = YourVideoSource()
OA = YourAudioSource()
NV = OV.AssumeFPS(OV.FrameRateNumerator(), OV.FrameRateDenominator()*2)
NA = OA.AssumeSampleRate(Round(AudioRate()/2.0))
AudioDub(NV,NA)
That way, you avoid having to time-stretch and resample the audio also.
DarkSpace is offline   Reply With Quote
Old 22nd January 2014, 14:05   #7  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,389
Quote:
I want to do the Youtube trick, without the youtube part.
Quote:
ultimately the real reason for wanting to do it. Which is to upload it to Youtube in the first place.
This is confusing. You say you want to do this "without the YouTube part" but that you also want to upload it to YouTube? You can't upload a video to YouTube without uploading it to YouTube...

There is no way to upload a clip to YouTube that will play back at 60fps.

Quote:
Create a 30fps clip that plays back with the temporal resolution of the original 60fps clip.
That's doesn't make any sense. If a video plays back at 60fps, then it's a 60fps clip. It can't be anything else. A 30fps video will always play back at 30fps. It's a fundamental property of the video.

It's like asking for a pot of non-sticky glue.

David
wonkey_monkey is offline   Reply With Quote
Old 23rd January 2014, 03:23   #8  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Quote:
Originally Posted by davidhorman View Post
This is confusing. You say you want to do this "without the YouTube part" but that you also want to upload it to YouTube? You can't upload a video to YouTube without uploading it to YouTube...

There is no way to upload a clip to YouTube that will play back at 60fps.


That's doesn't make any sense. If a video plays back at 60fps, then it's a 60fps clip. It can't be anything else. A 30fps video will always play back at 30fps. It's a fundamental property of the video.

It's like asking for a pot of non-sticky glue.

David
Yet in spite of this fact there is a link in my first post to a video on Youtube, that when played at 2x speed, looks 99% like what a 60fps clip would look like, with smooth temporal motion between frames.

Of course I'm not asking for a 30fps clip with the temporal resolution of a 60fps - that's physically impossible. I'm asking for a way to duplicate the EFFECT. Which I was pretty clear about - really

As far as why, I'm pretty sure I already answered that. So it can be uploaded to Youtube without burdening the user with having to use HTML5 (vs Flash, which some people prefer) and without having to modify the speed setting every time.

It's an academic exercise to see if it can be done, for the sake of doing it because I can. I don't really "need" a reason to experiment with something interesting. That's aside the fact it has practical applications for a small segment of Youtubers.

Last edited by osgZach; 23rd January 2014 at 03:25. Reason: spelling
osgZach is offline   Reply With Quote
Old 23rd January 2014, 03:31   #9  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Quote:
Originally Posted by DarkSpace View Post
No.
You want all of the following:
- All the frames unaltered.
- The video played at the correct speed.
- The frame rate of the video halved.

This is impossible, you'd have to sacrifice at least one of the 3 points (currently you sacrifice the "correct speed" point, because you rely on the player playing back at 2x speed).

That said, the easiest way to achieve what you've currently got is this:
Code:
OV = YourVideoSource()
OA = YourAudioSource()
NV = OV.AssumeFPS(OV.FrameRateNumerator(), OV.FrameRateDenominator()*2)
NA = OA.AssumeSampleRate(Round(AudioRate()/2.0))
AudioDub(NV,NA)
That way, you avoid having to time-stretch and resample the audio also.
Thanks.. I will play around with this when I have some free time..

I'm not necessarily sure it's that I want the video to play back at the "correct" speed, as you pointed out.. Well I feel like I would be splitting hairs there.

But it seems to be, that I have seen footage before, of cameras that record 30 progressive frames per second, and provide pretty good temporal resolution as well, not a lot of jitters and such with movement. I figure if there is a way for a camera to record that fairly smoothly, there has got to be a better way to smooth out 30fps clips, than blindly throwing out half the frames during the conversion. Or using motion blurs, or things like that. (On the subject of blur, would it be better to blur the 60fps footage before decimation, or after? I've never gotten good results with motion blur, personally. But I know little about correct application)

For Example: If I did this locally and played back a video processed to play 30fps at 2x speed - and I recorded THAT playback @30fps somehow, would it look equally as smooth as it does during the 2x playback? I suppose that is the fundamental question of what I am attempting to replicate.


If that doesn't clear it up for anyone, nothing probably ever will

Last edited by osgZach; 23rd January 2014 at 03:35. Reason: clarified
osgZach is offline   Reply With Quote
Old 23rd January 2014, 03:52   #10  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,984
Quote:
Originally Posted by osgZach View Post
T

For Example: If I did this locally and played back a video processed to play 30fps at 2x speed - and I recorded THAT playback @30fps somehow, would it look equally as smooth as it does during the 2x playback? I suppose that is the fundamental question of what I am attempting to replicate.

If you play 30fps at 2x speed. That is 60fps (frames per second) . Given you have the same number of frames, the duration is exactly 1/2 . That is basic math

If you recorded that 60fps video at 30fps, then only 1/2 the frames are captured . Every 2nd frame will be missed by your capture. ie. Every second is represented by 30 frames, not 60 - thus it won't be as smooth
poisondeathray is offline   Reply With Quote
Old 23rd January 2014, 06:24   #11  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
Quote:
Originally Posted by osgZach View Post
Yet in spite of this fact there is a link in my first post to a video on Youtube, that when played at 2x speed, looks 99% like what a 60fps clip would look like, with smooth temporal motion between frames.
There is NO EFFECT used in that guy's video. His original game clip IS 60fps.

And if you have a 60fps video clip already and want to change it to 30fps, you don't need to re-encode it. The frame rate declaration is just like a tag, all you have to do is put that tag and the video into a container that supports it, and it will playback at the declared frame rate, such as mkv. The re-encode of the video that the guy did is not necessary.

Last edited by lansing; 23rd January 2014 at 06:29.
lansing is offline   Reply With Quote
Old 23rd January 2014, 06:47   #12  |  Link
DarkSpace
Registered User
 
Join Date: Oct 2011
Posts: 204
So, you want 30 fps video played at 30 fps look like the original 60 fps video?
You could try either blending 2 frames together
Code:
YourVideoSource()
Merge(SelectEven(), SelectOdd())
or play around with interpolation. However, I don't think that blending will look that good, really, and I doubt if interpolation is what you're looking for if you apparently already tried playing with Motion Blur and such.
Alternatively, you can also just drop every other frame, but you already mentioned that you don't want that.
DarkSpace is offline   Reply With Quote
Old 23rd January 2014, 18:48   #13  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,389
Quote:
Originally Posted by osgZach View Post
Of course I'm not asking for a 30fps clip with the temporal resolution of a 60fps - that's physically impossible.
But that's exactly what you did ask for:

Quote:
Could you not also produce a 30fps video from a 60fps source, that plays back at the 60fps rate?
The framerate is a defining property of the video. There's no way for you to define a clip as "30fps, but play it back at 60fps," because that just makes it a 60fps clip.

Quote:
I'm asking for a way to duplicate the EFFECT. Which I was pretty clear about - really
What do you mean by "effect"? This is what I feel you haven't been clear about. You can't get the effect of 60fps footage (smooth motion) without actually having 60fps footage. It's like asking for the "effect" of a colour video without having to encode any colour.

Quote:
As far as why, I'm pretty sure I already answered that. So it can be uploaded to Youtube without burdening the user with having to use HTML5 (vs Flash, which some people prefer) and without having to modify the speed setting every time.
There is no way to upload a video to YouTube and have it play back at 60fps without doing the HTML5/double-speed playback trick. YouTube just doesn't support 60fps.

David
wonkey_monkey is offline   Reply With Quote
Old 25th January 2014, 13:18   #14  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
osgZach,
if I get you right, you just want to tell Youtube that a 60fps clip is 30fps.
In other words, upload a '0.5* slow motion' version of it.
For realtime playback then choose 2*speed in the player.
Right?

In an AVS script, use AssumeFPS(FrameRate*0.5) to give an output clip with a 60fps source a 30fps property.

Depending on the player - if it transposes the audio frequencies or just compresses them - use either AssumeSampleRate(AudioRate*0.5) to just give the audio e.g. the property 24000Hz sample rate for a 48000Hz source, or ResampleAudio(AudioRate*0.5) to give the audio 24000Hz sample rate without transposing the frequencies one octave down.

EDIT: DarkSpace posted almost the same answer already.
EDIT2: ResampleAudio will not time stretch the audio appropriately with AssumeFPS. Use vampiredom's TimeStretch suggestion instead.

Last edited by martin53; 25th January 2014 at 20:04. Reason: Added note about TimeStretch
martin53 is offline   Reply With Quote
Old 25th January 2014, 19:01   #15  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
Originally Posted by martin53 View Post
Depending on the player - if it transposes the audio frequencies or just compresses them
Yes, but the YouTube example requires timestretching the audio, no? It needs the 2x duration with the original pitch; it then skips samples on 2x playback.

Code:
I found the original video I watched to learn how to do the Youtube trick, so maybe it will explain things better.
https://www.youtube.com/watch?v=EsBXYHfYgmI
In this video, this is exactly what is done (using Audacity), so I think my suggestion of using TimeStretch is appropriate.

I do not see any way (or any sense) of doing this "without YouTube" (or some other HTML5 player), however.
vampiredom is offline   Reply With Quote
Old 25th January 2014, 20:02   #16  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
vampiredom,
I rechecked and if the Youtube player compresses playback time without changing the pitch (didn't bother to try that), then ResampleAudio is wrong, and only your TimeStretch suggestion was right.
So video quality is enhanced, but audio suffers - see the TimeStretch docpage; and the inverse playback audio manipulation will again introduce some inaccuracies.

Last edited by martin53; 25th January 2014 at 20:12.
martin53 is offline   Reply With Quote
Old 25th January 2014, 20:59   #17  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
So video quality is enhanced, but audio suffers - see the TimeStretch docpage; and the inverse playback audio manipulation will again introduce some inaccuracies.
Oh, most assuredly! But not too much worse than the existing "trick" does, though I am sure that plugins for Audicity or Audition, etc. can do a bit better of a job than AviSynth's TimeStretch.

I suppose I intended only to make a pure AVS version of the trick, rather than a reinvention / circumvention of it.
vampiredom 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 04:19.


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