Skip to content

Instantly share code, notes, and snippets.

@tmm1
Last active December 7, 2017 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmm1/fcbe42e9da85514fde48238463400552 to your computer and use it in GitHub Desktop.
Save tmm1/fcbe42e9da85514fde48238463400552 to your computer and use it in GitHub Desktop.

download sample 720p mpeg2video inside mpegts container

$ wget https://tmm1.s3.amazonaws.com/720p.ts

use yadif passthrough + x264 transcode to generate single and hls-segmented mpegts

$ ffmpeg -hide_banner -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f mpegts -y single.ts
Output #0, mpegts, to 'single.ts':
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 119.88 fps, 90k tbn, 119.88 tbc

$ ffmpeg -hide_banner -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f hls -hls_time 30 -y segment.m3u8
Output #0, hls, to 'segment.m3u8':
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 119.88 fps, 90k tbn, 119.88 tbc

generated files are identical except for "tbr" (r_frame_rate)

$ ffmpeg -hide_banner -i single.ts -i segment0.ts
Input #0, mpegts, from 'single.ts':
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 120 fps, 59.94 tbr, 90k tbn, 239.76 tbc
Input #1, mpegts, from 'segment0.ts':
    Stream #1:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 120 fps, 119.88 tbr, 90k tbn, 239.76 tbc
single.ts: 59.94 tbr
segment0.ts: 119.88 tbr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment