📜  ffmpeg mkv 到 mp4 - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:15:03.291000             🧑  作者: Mango

FFMPEG MKV to MP4 - Shell/Bash

FFMPEG is a powerful command-line tool used for handling multimedia files. It can be used for various purposes, such as converting video and audio files, apply filters, resize, and more.

In this article, we will focus on converting MKV files to MP4 using FFMPEG.

Prerequisites

Before we begin with the conversion process, make sure that you have FFMPEG installed on your system. If you don't have it installed, you can download it from the official website https://www.ffmpeg.org/download.html or use your system's package manager to install it.

Conversion process

To convert an MKV file to an MP4 file, we will use the following FFMPEG command:

ffmpeg -i input.mkv -codec copy output.mp4

Let's break down the command:

  • -i specifies the input file.
  • input.mkv is the input file name.
  • -codec copy tells FFMPEG to copy the video and audio streams to the output file without transcoding them.
  • output.mp4 is the output file name.

Note: If you want to change the video codec or apply any filters, you can modify the command accordingly.

Running the command

Open your terminal or command prompt and navigate to the directory where your MKV file is located. Then, run the following command:

ffmpeg -i input.mkv -codec copy output.mp4

Replace "input.mkv" with the name of your MKV file, and "output.mp4" with the desired name for your MP4 file.

After the conversion is completed, you will see a message that looks like this:

[mp4 @ 0x55f938bd6500] muxer does not support non seekable output
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default)
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
      encoder         : Lavc58.91.100 aac
size=    6896kB time=00:04:40.12 bitrate= 202.4kbits/s speed=42.6x    
video:6351kB audio:511kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.831233%

Congratulations! You have successfully converted an MKV file to an MP4 file using FFMPEG.

Conclusion

FFMPEG is a powerful tool that can be used for various multimedia tasks, including converting an MKV file to an MP4 file. The conversion process is straightforward and can be done by running a single command.

If you want to learn more about FFMPEG or need help with other multimedia tasks, check out the official documentation at https://www.ffmpeg.org/documentation.html.