Below example shows how to encode video in .ts by FFmpeg

To encode video in standard TS format

ffmpeg -i input.mp4 \
       -c:v mpeg2video -qscale:v 2 \
       -c:a mp2 -b:a 192k \
       output.ts

To encode video in x264 and mp4a

ffmpeg -i input.mp4 \
       -c:v x264 -qscale:v 2 \
       -c:a mp4a -b:a 192k \
       output.ts

For your information qscale:v 1 is hte highest/largest filesize, 31 beging the lowest quality/smallest filesize

To encode video in x264 and mp4a in 30fps

ffmpeg	-i input.mp4 \
		-c:v x264 -qscale:v 2 \
		-filter:v fps=fps=30 \
		-c:a mp4a -b:a 192k \
		output.ts

For your information qscale:v 1 is hte highest/largest filesize, 31 beging the lowest quality/smallest filesize

To generate segmented HLS(HTTP Live Streaming) file

ffmpeg -re -i input.mp4 \
       -codec copy -map 0 \
       -f segment -segment_list playlist.m3u8 \
       -segment_list_flags +live -segment_time 10 \
       out%03d.ts
  • No labels