Implement ability to specify resolution with bitrates. See HLS-27
author B Tasker
()
committer B Tasker
()
commit 2cac89e5184c89f4f4634d222bd99214feb86c5a
tree f8d18e5c2fd9577e03cb67dc306eb7dd38a7a026
parent 393bbce103c29ec3cd289c74db8008b362c1940a
Implement ability to specify resolution with bitrates. See HLS-27

This is just a first pass at this, and I fully expect it to break in a variety of weird and wonderful ways.

There's also some reliance on globals that I don't like (see comments in file), so that's still in need of tidying up. We should probably also think about testing that none of the given resolutions are higher than that of the source.

But, you can now pass a resolution in as part of the bitrate string: {{bitrate-widthxheight}}

As an example, ran the following test encode
{noformat}$ ./HLS-Stream-Creator.sh -i testvid.mp4 -b 2744,1000-1280x720 -s 10
{noformat}
The original is 1080p at 2744k so that should give us a 1080p rendition as well as a 720p.

Master playlist is generated correctly
{noformat}$ cat testvid_master.m3u8
testvid_2744.m3u8
testvid_1000-1280x720.m3u8
{noformat}

Segments report approximately the right bitrate (used vbr to speed up the test), and also the correct resolution
{noformat}$ ffprobe -i testvid_1000_00001.ts
Input #0, mpegts, from 'testvid_1000_00001.ts':
Duration: 00:00:13.70, start: 12.890956, bitrate: 989 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 100 kb/s

$ ffprobe -i testvid_2744_00001.ts
Input #0, mpegts, from 'testvid_2744_00001.ts':
Duration: 00:00:13.70, start: 12.890956, bitrate: 2335 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 100 kb/s
{noformat}

Not been tested with a linear stream yet (though it _should_ work)
HLS-Stream-Creator.sh