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 have two videos from different sources.

I want to convert one of them so that its format, codec, framerate are the same as the other one.

Is there a one-liner for it (where I can give the "reference" video as option) or what is the best way?

I can use ffmpeg or mencoder or any Linux command line tool.

Clarification: I am after a general approach that is going to work everytime: without knowing anything about video1, I would like video2 to be converted into the same format, codec, framerate as video1

Addition Some background: I need that because I am trying to concatenate two videos. I am using mencoder but it requires the videos to be of the same codec, same framerate and other things. So I need to convert one of the same to be of the same "type" as the other one but I wouldn't want to dive in the "codecs realm".

share|improve this question
    
You need to provide more information. What operating system are you using? What formats are you converting? –  wizlog Dec 14 '11 at 17:42
    
Hi. I think I already said I am using Linux. I am not trying to convert to a particoular format: I am looking for a general solution (I may edit my question to make it clearer). Thanks. –  dan Dec 14 '11 at 17:45
    
Please edit your question to make it clearer, and to tag your question linux because it relates to the Linux operating system. –  wizlog Dec 14 '11 at 17:46
    
I have edited my question. Does it really matter which Operative System I am on when using ffmpeg or mencoder? –  dan Dec 14 '11 at 17:48
1  
This is a good idea, but I think this is impossible because of specific parameters used when encoding the scene. More than just bitrate defines the quality of the picture, and this information is not qualitatively encoded into the stream (B-frames maybe, but all others like motion estimation and psychovisual analysis would be qualitative). –  Breakthrough Dec 14 '11 at 23:01
show 1 more comment

1 Answer

I don't know of a tool that could do it. The only solution I can think of is to write a shell script that finds the necessary information about video1 and then converts video2 to that format using ffmpeg. Roughly, it would be

ffmpeg -i video1 > props.txt
#lots of string parsing here. Sorry, but I don't have the time to work it all out now.
ffmpeg -i video2 [options you dug out earlier] video2.out

Obviously not a complete solution, but a rough idea. Hope this helps.

share|improve this answer
1  
Thanks for your solution. I still hope someone knows about a more "automatic" solution. I guess your step one can be achieved also by: ffmpeg -i video1 –  dan Dec 14 '11 at 23:57
    
True, didn't think of that. It also looks like your way's output is easier to handle. I'll edit to reflect that. –  Yitzchak Dec 15 '11 at 0:05
    
Good idea to edit your answer. Maybe it would make sense to vote up for my previous comment, then ;-) –  dan Dec 15 '11 at 0:13
add comment

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.