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 superuser.com/questions/576251/… – Ryan Apr 7 '16 at 23:34
  • @Ryan, I agree it is similar (although that question only deals with x264). – Andrea Lazzarotto Apr 8 '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 8 '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 8 '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 8 '16 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.