How to Generate playlist and all ts chunks from video on demand asset

To chunk up an entire VOD asset to its corresponding ts segments, you can use the following FFMPEG bash script example:

Name: chunks.sh

#!/bin/bash
file=$1
pathToChunks=$2

ffmpeg -i $file -acodec copy -bsf:a h264_mp4toannexb -g 105 -vcodec libx264 -vprofile baseline -bf 0 -maxrate 350k -bufsize 850k -s 960×540 -bsf:v dump_extra -map 0 -f segment -segment_format mpegts -segment_list “$pathToChunks/playlist.m3u8″ -segment_time 10 “$pathToChunks/chunk-%03d.ts”

Run this by invoking:

command-line] sh ./chunks.sh sample.mp4 /path/to/chunk/dir

This will output all the .ts chunks in the /path/to/chunk/dir directory along with the full playlist.


Comments are closed.