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 > General > Linux, Mac OS X, & Co
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st April 2009, 09:14   #1  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
ChangeFps with ffmpeg/mencoder

Is there a way to convert the output of mencoder/ffmpeg to a specific framerate while keeping the playback length?
(like Avisynth -> changefps does, through duplicating or dropping frames)

Sometimes I have 60i/50p/30p/... material that I want to convert to 25fps or 15fps (or the othermay around convert 15fps material to 25fps material) and I'm looking for a way to do this via mencoder/ffmpeg.

Using mencoder I hoped:
(from 25p to 50p)
Code:
-fps 25 -speed 0.5 -ofps 50
(from 50p to 25p)
Code:
-fps 50 -speed 2 -ofps 25
would to the job (fps->Input framerate, ofps->outputframerate, speed->slowdown-/speedup-factor)

Is doing this possible with ffmpeg/mencoder, if so how?

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 1st April 2009 at 10:08.
Selur is offline   Reply With Quote
Old 1st April 2009, 09:50   #2  |  Link
fangorn
Registered User
 
Join Date: Jun 2008
Posts: 42
the filter chain you have as example might work if you exchange 25 and 50 values.

In general this is not an easy conversion. In most cases video will be jumpy, choppy, ... and you most definately will lose audio sync.

What is possible (even if it is not so easy also) is to get a 23.976 fps movie out of a NTSC 29.96 fps dvd. Or produce a 25fps PAL movie out of a 23.976 fps Movie (while shortening the runtime of course). And even this might or might not work.
fangorn is offline   Reply With Quote
Old 1st April 2009, 10:01   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
mixed up, tried to convert 25p to 50p material using the line above
But frame count does not change at all.
Quote:
In general this is not an easy conversion.
I'm aware of the 'crappyness' of just duplicating/dropping frames, but I can't get mencoder to duplicating/dropping frames.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 1st April 2009, 10:22   #4  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Have you tried without -speed? I don't have any problems with only using -ofps <target_fps> and nothing else. Frames are dropped or duplicated when necessary and A/V sync is kept.

If that doesn't work, post your full command-line.
nm is offline   Reply With Quote
Old 1st April 2009, 10:51   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
here what I used:
trying to convert 25p->50p:
Code:
mencoder -lavdopts threads=4 "PATH TO INPUT" -ovc raw -nosound -vf scale,format=i420 -fps 25 -speed 0.5 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 50 --output "PATH TO OUPUT" - 640x352
I also tried -ofps 50 widh and without -speed but everytime input and output both have the same framecount.
50p->25p works with: -vf framestep=2
Code:
mencoder -lavdopts threads=4 "PATH TO INPUT" -ovc raw -nosound -vf framestep=2,scale,format=i420 -fps 50 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 25 --output "PATH TO OUTPUT" - 640x352
-ofps 12.5 also halves the framerate,
so seems like scaling the framerate down seems to work, but how to upscale the framerate.

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 1st April 2009 at 11:36.
Selur is offline   Reply With Quote
Old 1st April 2009, 12:04   #6  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Add harddup to the end of the filter chain and specify the desired framerate with -ofps. Looks like harddup is required when using raw output.
nm is offline   Reply With Quote
Old 1st April 2009, 13:36   #7  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Nice! Thanks! Framerate looks fine now, but it seems to break the colorspace.
used:
Code:
mencoder -lavdopts threads=4 "test.avi" -ovc raw -nosound -vf scale,format=i420,harddup  -ofps 50 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 50 --output "test.mp4" - 640x352
(Input, Output)

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 1st April 2009, 13:58   #8  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Looks like the output gets corrupted by messages that MEncoder writes to standard output. Use -really-quiet.

Actually I'm not sure why that corruption doesn't happen normally for you when using that command-line. I had to add -really-quiet to be able to encode a test video even when not changing the framerate.
nm is offline   Reply With Quote
Old 1st April 2009, 14:04   #9  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
LOL, seems like it works, funny think is normally I always use '-really-quiet' just didn't add it to get some infos what could go wrong.

Thanks a lot for the help.

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 1st April 2009 at 15:08.
Selur is offline   Reply With Quote
Reply


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 16:41.


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