FFmpeg Convert Video Format

FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing video and audio files. It is widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects, and standards compliance (SMPTE, ITU).

Wikipedia ── FFmpeg

Introduction

在本篇文章中會透過 FFmpeg 實現將影片編碼轉換。

Installation

  1. FFmpeg 官網下載壓縮檔,並解壓縮至指定目錄(e.g. C:\ffmpeg)。

  2. 開啟命令提示字元,並到解壓縮目錄:

    1
    > cd C:\ffmpeg
  3. 執行命令:

    1
    > ffmpeg.exe -i input.avi output.mp4

Batch Convert

1
2
3
4
5
6
7
8
9
@ECHO OFF

:: Origin
CMD /k FOR %%s in (%*) do ffmpeg -i %%s -c copy -map 0:v -map 0:a -bsf:a aac_adtstoasc %%s.mp4

:: Re-encode
:: CMD /k FOR %%s in (%*) do ffmpeg -i %%s -c:v libx264 %%s.mp4

PAUSE

References