4

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".

7
  • You need to provide more information. What operating system are you using? What formats are you converting?
    – wizlog
    Dec 14, 2011 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, 2011 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, 2011 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, 2011 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). Dec 14, 2011 at 23:01

1 Answer 1

1

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.

3
  • 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, 2011 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, 2011 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, 2011 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .