Closed defagos closed 1 year ago
We could also use a Docker image based on https://github.com/SRGSSR/docker-nginx-vod-module, as discussed with @bgaudaen.
One limitation in comparison to what we have is that the chunk size would be globally defined, whereas we are currently able to tweak it per sample stream.
Tools we could likely use as well:
mediastreamsegmenter
and variantplaylistcreator
. This book can probably be helpful. The modern tool documentation, quite shorter, can be found here.Below is a quick feedback. I also opened a (currently private) repository for investigation. This repository provides generation scripts. Generated content can then be served locally with
python3 -m http.server 8765 <directory>
Overall recommendation: Shaka Packager, as it supports most features we need to test.
Most definitely too obscure to use IMHO. Probably too powerful for our needs.
Quite easy to use but lacks some features like support for FORCED
subtitles or characteristics for AD. Could probably be added through a PR on mp4_dash.py
, though, but requires to do the same work for DASH packaging as well.
Quite easy to use but lacks support for FORCED
subtitles. Supports characteristics with hls_characteristics
, though, thus marking audio tracks for AD is possible. We could probably make a PR to add support for an hls_forced
flag.
The language can be set with the lang
descriptor. For a complete list of available descriptors refer to the source code.
Here is an example of how to add English and French subtitles to a stream.
1
00:00:0,000 --> 00:00:1,000
Subtitle 1
2
00:00:1,000 --> 00:00:2,000
Subtitle 2
3
00:00:2,000 --> 00:00:3,000
Subtitle 3
3
00:00:3,000 --> 00:00:4,000
Subtitle 4
1
00:00:0,000 --> 00:00:1,000
Sous-titre 1
2
00:00:1,000 --> 00:00:2,000
Sous-titre 2
3
00:00:2,000 --> 00:00:3,000
Sous-titre 3
3
00:00:3,000 --> 00:00:4,000
Sous-titre 4
To convert to another format (
vtt
for example) we can useffmpeg
.ffmpeg -i subtitles_en.srt Medias/subtitles_en.vtt
ffmpeg -i <#video_path.mov#> -i <#path/subtitles_en.srt#> -i <#path/subtitles_fr.srt#> \
-map 0 -map 1 -map 2 \
-c:v copy -c:a copy -c:s mov_text \
-metadata:s:s:0 language=eng -metadata:s:s:1 language=fre \
<#output_path#>.mp4
ffmpeg -i Medias/nyan_cat.mov -i Medias/subtitles_en.srt -i Medias/subtitles_fr.srt \
-map 0:v:0 -map 0:a:0 -map 0:a:0 -map 1:s:0 -map 2:s:0 \
-c:v copy -c:a copy -c:s webvtt \
-metadata:s:s:0 language=eng -metadata:s:s:1 language=fre \
-metadata:s:a:0 language=eng -metadata:s:a:1 language=fre \
Medias/nyan_cat_subtitled.mkv
ffmpeg -stream_loop -1 \
-i "$MEDIAS_DIR/nyan_cat_subtitled.mkv" \
-c:s webvtt \
-map 0:v -map 0:a:0 -map 0:s:0 \
-f hls \
-var_stream_map "v:0,a:0,s:0,sgroup:subtitle,language:eng,name:english" \
-master_pl_name master.m3u8 \
-t 120 -hls_time 10 -hls_init_time 4 -hls_list_size 10 \
-master_pl_publish_rate 10 \
-hls_flags delete_segments+discont_start+split_by_time \
-hls_segment_filename "$ON_DEMAND_SUBTITLED_DIR/%v/seg%03d.ts" \
"$ON_DEMAND_SUBTITLED_DIR/%v/video.m3u8"
This approach works only for one subtitle track.
DVR to on-demand transition is probably not so useful for a unit testing setup since such a scenario requires the stream to be started, played for a while as a DVR stream before the stream changes to an on-demand one.
Work is being done to modernize how Shaka Packager is built using CMake. Currently migration has not reached a sufficient state so that we can efficiently work on adding forced subtitles support, though.
As a developer I want to have reliable local test streams with minimal footprint (i.e. files stored in the repo), covering future implementation needs:
Acceptance criteria
Hints
From @amtins: See https://www.bogotobogo.com/FFMpeg/ffmpeg_video_test_patterns_src.php
Proposal for a time-displaying video:
Tasks