4

I have a MP4 file with AAC audio and H264 video, let's call it B.mp4. I also have file A.mp4 with the same picture resolution, but:

  • different FPS
  • possibly different audio/video bitrate
  • different codecs

I would like to re-encode file A.mp4 with the exact same settings as B.mp4 because after that I want to use mkvmerge to mux them together, so they must match. How can I do this? Is there a way to "copy" settings from B.mp4 to A.mp4?

Up to now I am able to see some codec information using mediainfo or mplayer -identify, but I don't know how to pass everything to ffmpeg (preferably) or mencoder.

The command I am looking for should copy every setting (codec, bitrate, frame rate, ...) from one video to the re-encoded version of the other one. Even better if I can specify starting and ending keyframes on video A.mp4.

  • This seems to be similar to http://superuser.com/questions/576251/ffmpeg-how-to-copyextract-encoding-settings-from-existing-media-file – Ryan Apr 07 '16 at 23:34
  • @Ryan, I agree it is similar (although that question only deals with x264). – Andrea Lazzarotto Apr 08 '16 at 13:50
  • Your question specified reading encoding settings from an H.264 encoded file. x264 is an H.264 encoder. The two terms are used interchangeably. The other question asks how to read the encoding settings of one file to pass them as arguments to an encoder (ffmpeg) using some commandline-fu, and so does this one. How are the questions different? – Ryan Apr 08 '16 at 15:52
  • You do realize that H264 codec and MP4 containers were just examples and my question asks for a general method, right? I can edit it to refer to WMV or MOV if you prefer. – Andrea Lazzarotto Apr 08 '16 at 16:00
  • No, I did not realize. When you say "I have a MP4 file with AAC audio and H264 video, let's call it B.mp4", the implication to me is that you actually have an MP4 file with AAC audio and H.264 video, but you've provided a simplified/false name. – Ryan Apr 08 '16 at 16:24
  • In any case, no, I don't think changing the example to different formats or containers really separates this question from that one much, since the other question essentially asks "How can I extract encoding settings (container, codec, bitrate, quality) from an existing audio/video file in order to use them (directly) for encoding with ffmpeg?" which is basically what you're asking here. The asker *does* use x264 as an example, and the answer likewise uses x264 as an example, but the overall suggestion is that it's quite difficult and would require a complex script to accomplish. – Ryan Apr 08 '16 at 16:30
  • Sorry for not making clear that I was seeking for a general solution. The link you have shown does not provide a complete answer, though. If one asks "how do I...?" and the reply is "It's difficult to do generally" then the question is still open (at least partially). Were the problem easy/trivial, I wouldn't have bothered to ask in the first place... we know it's difficult, but commercial Windows software do that routinely so it is possible to do via software. How to do that on a UNIX/Linux system remains to be discovered. – Andrea Lazzarotto Apr 08 '16 at 17:27
  • I'm posting the same question as in the other post. It's 2020 now. Any updates on this? – cduguet Nov 05 '20 at 16:52

0 Answers0