LoginSignup
1
1

More than 5 years have passed since last update.

FFmpegを使用したHLS形式への動画変換の仕方

Last updated at Posted at 2019-01-26

はじめに

HLS形式を使用すると動画配信を簡単に行えるようなので、配信用動画の作成方法をまとめてみる。

やること

Lubuntu16.04にFFmpegをインストールし、動画ファイルをtsファイルとm3u8ファイルに変換する。

FFmpegのインストール

まず、以下のコマンドを実行し、リポジトリの追加とFFmpegのインストールを行う。

$ sudo add-apt-repository ppa:jonathonf/ffmpeg-3
$ sudo apt update
$ sudo apt install ffmpeg libav-tools x264 x265
$ ffmpeg -version

動画の変換

以下のコマンドを実行し、動画を変換する。

$ ffmpeg -i ファイル名 -codec copy -map 0 -f segment -vbsf h264_mp4toannexb -segment_format mpegts -segment_time チャンク秒数 -segment_list プレイリスト名.m3u8 チャンクファイル名-%03d.ts

「ファイル名」、「チャンク秒数」、「プレイリスト名」、「チャンクファイル名」には、それぞれ環境にあったものを入力する。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1