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

Dan
  • 267
  • 2
  • 4
  • 9
  • 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 [tag: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
  • Breakthrough, true what you were saying, being the same from just a quantitative point of view is more than enough for me. I am going to add some background to my question to help you understand why. – Dan Dec 14 '11 at 23:10
  • I usually have to deal with this while programming - I know of a video that _works_ on a given set of platforms, and I need mine's to mirror it's codecs/bitrates/whatever so that it plays OK in the same set of platforms. I'd expect `ffmpeg` to have some flag to do that, but it seems it's not doable :( – mgarciaisaia Aug 17 '16 at 17:51

1 Answers1

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.

Yitzchak
  • 4,424
  • 6
  • 26
  • 44
  • 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 00: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 00:13