Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to encode a 30 min video using ffmpeg. I am able to achieve this using

ffmpeg -i in.mp4 -vcodec libvpx -vb 1024k -keyint_min 150 -g 150 -an out.webm

But I would like to encode different segments of the video at different rate and not use a constant rate of 1024k. Is this possible?

I know what time they have to switch encoding. For example say 5 min of video I want an encoding rate of 1024k and next 5 min I am okay with 250k bitrate. I do not want to use VBR or I don't want to cut the video and encode them at different rates and then join them.

Is this possible. I read the man page for ffmpeg and saw there were options for

startime and time 

But I am not sure how exactly I can do this assuming this to be possible.

share|improve this question

migrated from stackoverflow.com Dec 4 '12 at 21:06

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 0 down vote accepted

But I would like to encode different segments of the video at different rate and not use a constant rate of 1024k. Is this possible?

No. This is simply not a very typical use case. Either you want constant bit rate (e.g. when streaming), or you want variable bit rate (constant quality). In the latter case, the encoder will select the appropriate bit rate to match your quality setting, or it will use the quantization parameters that you supply. See this document for the encoding modes supported by libvpx.

I do not want to use VBR or I don't want to cut the video and encode them at different rates and then join them.

This would probably be the only way to do it. You'd have to find a way to export the raw VP8 video bitstreams (which is possible with ffmpeg … -f rawvideo out.webm), join them together, and then wrap them again inside a WebM container. I haven't found a working solution for this though.

Or you could modify the libvpx encoder's source code in such a way that it accepts changing the constant bitrate on a per-time basis.

I read the man page for ffmpeg and saw there were options for startime and time

There are no such options in FFmpeg. There's a -ss option that changes the start time for the encoding process, and the -t option that specifies how long you'd like FFmpeg to encode for. But those are only useful for cutting video.

share|improve this answer
    
If you can give me a working solution for option 2 then that is the best of both worlds. For the startime and time I meant if there was some way to use those options to encode without cutting. I read the man pages and knew I could not get this done right away. So, I mentioned them here if I could use some hack to use them. –  Pavan K Dec 4 '12 at 14:45
    
Can I break or cut the video into "x" second parts using ffmpeg?? I mean if I have a 2 min video I need ffmpeg to cut and encode the video into 10 equal parts?? –  Pavan K Dec 4 '12 at 14:49
    
I'm not sure it's entirely possible to concatenate VP8 bitstreams, but maybe someone has a more concrete solution to that. // To break it apart you'd have to write a script of some sort (Bash, Python, Ruby, …), that repeatedly calls ffmpeg -ss <start> -i input.mp4 -c copy -t 10 out<number>.mp4. –  slhck Dec 4 '12 at 14:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.