smooth slow motion?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

smooth slow motion?

Mikko Rapeli
Hello,

I'd like to slow down some 720p30 videos and make it smooth with some
kind of motion compensation or resampling, or what ever it's really
called. I found a few instructions like
http://www.renomath.org/ejolson/video/slowmot/ and
http://eugenia.gnomefiles.org/2009/02/09/butter-smooth-slow-motion/
but they are either for interlaced video or done with Windows tools.

Is there a way to get smooth slow motion from progressive video with
ffmpeg and some other tools?

Thanks,
-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: smooth slow motion?

Stefan de Konink-3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Mikko Rapeli schreef:
> Is there a way to get smooth slow motion from progressive video with
> ffmpeg and some other tools?

Cinelerra can do it (interpolation) out of the box; maybe you can try it
from there.


Stefan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREKAAYFAksAdn8ACgkQYH1+F2Rqwn1gkwCeIQHfL2RWn8cI+59LGcSNYX+3
dl8An2fBXrdi+sVbX2Bc+wYYqJS7CUtn
=v1XR
-----END PGP SIGNATURE-----
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: smooth slow motion?

Mikko Rapeli
On Sun, Nov 15, 2009 at 10:45:35PM +0100, Stefan de Konink wrote:
> Mikko Rapeli schreef:
> > Is there a way to get smooth slow motion from progressive video with
> > ffmpeg and some other tools?
>
> Cinelerra can do it (interpolation) out of the box; maybe you can try it
> from there.

Thanks, I'll give it a try. My main video editor at the moment is
kdenlive so any command line hack to produce smooth slow motion would
be nice to know too. kdenlive at the moment doesn't interpolate slowmotion,
at least slow motion doesn't look too nice.

-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: smooth slow motion?

Mikko Rapeli
In reply to this post by Stefan de Konink-3
On Sun, Nov 15, 2009 at 10:45:35PM +0100, Stefan de Konink wrote:
> Mikko Rapeli schreef:
> > Is there a way to get smooth slow motion from progressive video with
> > ffmpeg and some other tools?
>
> Cinelerra can do it (interpolation) out of the box; maybe you can try it
> from there.

Hmm, tried cinelerra from debian-multimedia.org. With ReframeRT I can
slow down the video, but it doesn't interpolate. If I add Interpolate to
the effect stack higher or lower than ReframeRT, it doesn't help. Output
still contains duplicated frames.

If I just use interpolate and set input framerate to 59 point something
for p30 mjpeg source video I get some kind of interpolation, but it is
buggy:

http://mcfrisk.kapsi.fi/linux/video/smooth_slow_motion/cinelerra_interpolate_smooth_slow_motion_test.mov

How did you create smooth looking slow motion with cinelerra?

http://cinelerra.org/user-tips.php lists some tools which I'll try next:

http://jcornet.free.fr/linux/yuvmotionfps.html
http://www.freenet.org.nz/misc/framerate.py

Thanks,

-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

slow down from 720p60 to 720p30?

Mikko Rapeli
In reply to this post by Mikko Rapeli
How to slow down a 60 fps video to 30 fps, and convert 48kHz audio to
24kHz? And without many rounds of re-encodings?

Here's a sample:

http://mcfrisk.kapsi.fi/linux/video/gopro_hd_hero/GOPR0007_720p60.MP4

For mplayer the fps is easy, just -fps 30, but I need the slowed down clip
for further editing with other p30 clips. I tried forcing container fps with
ffmpeg -i infile -r 29.97 -vcodec copy outfile, but that didn't work since
kdenlive editor trusts the stream framerate.

-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: slow down from 720p60 to 720p30?

Mikko Rapeli
On Wed, Dec 09, 2009 at 11:17:37PM +0200, Mikko Rapeli wrote:

> How to slow down a 60 fps video to 30 fps, and convert 48kHz audio to
> 24kHz? And without many rounds of re-encodings?
>
> Here's a sample:
>
> http://mcfrisk.kapsi.fi/linux/video/gopro_hd_hero/GOPR0007_720p60.MP4
>
> For mplayer the fps is easy, just -fps 30, but I need the slowed down clip
> for further editing with other p30 clips. I tried forcing container fps with
> ffmpeg -i infile -r 29.97 -vcodec copy outfile, but that didn't work since
> kdenlive editor trusts the stream framerate.

Any clues, someone?

Should I dump the stream to jpg frames and a wav audio track, and then assemble
them into one container?

-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: slow down from 720p60 to 720p30?

Alexandre Ferrieux
On 06/01/2010 15:35, Mikko Rapeli wrote:

> On Wed, Dec 09, 2009 at 11:17:37PM +0200, Mikko Rapeli wrote:
>> How to slow down a 60 fps video to 30 fps, and convert 48kHz audio to
>> 24kHz? And without many rounds of re-encodings?
>>
>> Here's a sample:
>>
>> http://mcfrisk.kapsi.fi/linux/video/gopro_hd_hero/GOPR0007_720p60.MP4
>>
>> For mplayer the fps is easy, just -fps 30, but I need the slowed down clip
>> for further editing with other p30 clips. I tried forcing container fps with
>> ffmpeg -i infile -r 29.97 -vcodec copy outfile, but that didn't work since
>> kdenlive editor trusts the stream framerate.
>
> Any clues, someone?
>
> Should I dump the stream to jpg frames and a wav audio track, and then assemble
> them into one container?

Sorry for the noob advice, but since nobody steps fwd :-}

I'd decode to a "flat", "timeless" container like raw_video (passing the proper geometry and pix_fmt) to stdout, piped
to a second instance of ffmpeg where you cheat with the input "-r", passing 30:

    ffmpeg -i file.mp4 -f rawvideo -pix_fmt yuv420p -s 1280x1024 - | \
    ffmpeg -f rawvideo -r 30 -pix_fmt yuv420p -s 1280x1024 -i - out.mp4

-Alex



*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration.
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: slow down from 720p60 to 720p30?

Mikko Rapeli
On Wed, Jan 06, 2010 at 03:52:44PM +0100, [hidden email]
wrote:
> I'd decode to a "flat", "timeless" container like raw_video (passing the
> proper geometry and pix_fmt) to stdout, piped to a second instance of
> ffmpeg where you cheat with the input "-r", passing 30:
>
>    ffmpeg -i file.mp4 -f rawvideo -pix_fmt yuv420p -s 1280x1024 - | \
>    ffmpeg -f rawvideo -r 30 -pix_fmt yuv420p -s 1280x1024 -i - out.mp4

Great! This works but quality is a bit low. Original has 15000k bitrate.
I tried a few -b and -sameq options but they didn't work. How to upgrade to
original quality?

-Mikko
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: slow down from 720p60 to 720p30?

Alexandre Ferrieux
On 06/01/2010 22:14, Mikko Rapeli wrote:

> On Wed, Jan 06, 2010 at 03:52:44PM +0100, [hidden email]
> wrote:
>> I'd decode to a "flat", "timeless" container like raw_video (passing the
>> proper geometry and pix_fmt) to stdout, piped to a second instance of
>> ffmpeg where you cheat with the input "-r", passing 30:
>>
>>     ffmpeg -i file.mp4 -f rawvideo -pix_fmt yuv420p -s 1280x1024 - | \
>>     ffmpeg -f rawvideo -r 30 -pix_fmt yuv420p -s 1280x1024 -i - out.mp4
>
> Great! This works but quality is a bit low. Original has 15000k bitrate.
> I tried a few -b and -sameq options but they didn't work. How to upgrade to
> original quality?

Note that with separate processes doing the decoding and encoding, "sameq" is a bit strange ;-)
So basically what you need to do is optimize the quality of encoding for a given input resolution. You could:

  - either try to stick to the mp4 input's codec and parameters (h264), using one of the various ffpresets to match (or
slightly exceed) the original's bitrate, keeping an eye on quality (no need to overshoot in bandwidth).

  - or decide that you don't care, and use a simpler codec, being prepared to have a much larger output bitrate.

So, -vcodec, -vb, and -vpre should be your friends...

-Alex

*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration.
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: slow down from 720p60 to 720p30?

Shadow_7
In reply to this post by Mikko Rapeli
--- On Wed, 1/6/10, Mikko Rapeli <[hidden email]> wrote:

> >    ffmpeg -i file.mp4 -f rawvideo -pix_fmt
> yuv420p -s 1280x1024 - | \
> >    ffmpeg -f rawvideo -r 30 -pix_fmt yuv420p
> -s 1280x1024 -i - out.mp4
>
> Great! This works but quality is a bit low. Original has
> 15000k bitrate.
> I tried a few -b and -sameq options but they didn't work.
> How to upgrade to
> original quality?
>
> -Mikko

Use -sameq (or -qscale 1) on BOTH ends of the pipe.

FWIW, (I'm still a bit behind reading this list) there's two ways to change the framerate that I've had success with.

#rawvideo#

ffmpeg -r 60000/1001 -i file -sameq -s 1280x720 -aspect 16:9 \
       -intra -pix_fmt yuv420p -f rawvideo - | \
ffmpeg -r 30000/1001 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p \
       -f rawvideo -i - -sameq -vcodec mpeg4 -y out.avi

You're basically telling rawvideo what the input rate is because it doesn't know.  For video of any length you should probably use -qscale 1 instead of -sameq.  The other method involves mjpegtools and yuvfps.

#yuvfps#

ffmpeg -i file -sameq -intra -s 1280x720 -aspect 16:9 \
       -pix_fmt yuv420p -f yuv4mpegpipe - 2>/dev/null | \
yuvfps -v 0 -s 30000:1001 -r 30000:1001 | \
ffmpeg -f yuv4mpegpipe -i - -sameq -vcodec mpeg4 -y out.avi

If the -s and -r of yuvfps match, it just passes it on, no questions asked.  -intra sends all I-frames (in theory), maybe not needed, but why not.  This also frees up the option to use other pipes like yuv_correct to adjust brightness and colors.  The downside is it's slower, and you have to use yuv420p.  With rawvideo you can specify yuv422p or other (might be more relevant) color spaces.  The downside of rawvideo is that you have to tell it EVERYTHING on the receiving end.  Using yuv4mpegpipe and yuvfps is a bit less needy in parameters.  

Both methods basically involve telling a lie.  And either pretty much dictates handling audio separately.  I typed those commands in by hand so they may be incomplete.  Most of my encodes have gotten complex enough that I've put them into bash scripts.  It's just easier to manage / remember that way.

- James



     
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user