A ready-prepared video transcoding pipeline to create DASH/ HLS compatible video files & playlists
10K+
A ready-prepared video transcoding pipeline to create DASH/ HLS compatible video files & playlists.
Recommended usage via Docker Docker Desktop & Docker Hub.
Prerequisite: Docker needs to be installed and running.
docker pull majamee/alpine-dash-hls
docker run -v /absolute/path/to/video/:/video majamee/alpine-dash-hls name_of_my_video_file.ext
Please just replace in the command above the absolute path to your video file folder and the full file name of your video file to be converted.
You can also use tags like majamee/alpine-dash-hls:edge (e.g. uses alpine's edge version as base).
There is also a parameter --transcode-only which you can append to the docker run command, in order to skip the html and image file output.
Example:
docker pull majamee/alpine-dash-hls
docker run -v /absolute/path/to/video/:/video majamee/alpine-dash-hls name_of_my_video_file.ext --transcode-only
(Based on work of squidpickles)
Just use Kitematic to open the shared folder, place your video file in there, replace "input.mkv" in the commands below by your input video file (without "") and execute the shell commands subsequent into the Docker container.
# 1080p@CRF22
ffmpeg -y -threads 0 -i "input.mkv" -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -profile:v high -level 4.0 -vf "scale=min'(1920,iw)':-4" -crf 22 -movflags faststart -write_tmcd 0 intermed_1080p.mp4
# 720p@CRF22
ffmpeg -y -threads 0 -i "input.mkv" -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -profile:v high -level 4.0 -vf "scale=min'(1280,iw)':-4" -crf 22 -movflags faststart -write_tmcd 0 intermed_720p.mp4
# 480p@CRF22
ffmpeg -y -threads 0 -i "input.mkv" -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -profile:v high -level 4.0 -vf "scale=min'(720,iw)':-4" -crf 22 -movflags faststart -write_tmcd 0 intermed_480p.mp4
# 128k AAC audio only
ffmpeg -y -threads 0 -i "input.mkv" -vn -c:a aac -b:a 128k audio_128k.m4a
# Create MPEG-DASH files (segments & mpd-playlist)
MP4Box -dash 2000 -rap -frag-rap -url-template -dash-profile onDemand -segment-name 'segment_$RepresentationID$' -out playlist.mpd intermed_1080p.mp4 intermed_720p.mp4 intermed_480p.mp4 audio_128k.m4a
# Create HLS playlists for each quality level
ffmpeg -y -threads 0 -i intermed_1080p.mp4 -i audio_128k.m4a -map 0:v:0 -map 1:a:0 -shortest -acodec copy -vcodec copy -hls_time 2 -hls_list_size 0 -hls_flags single_file segment_1.m3u8
ffmpeg -y -threads 0 -i intermed_720p.mp4 -i audio_128k.m4a -map 0:v:0 -map 1:a:0 -shortest -acodec copy -vcodec copy -hls_time 2 -hls_list_size 0 -hls_flags single_file segment_2.m3u8
ffmpeg -y -threads 0 -i intermed_480p.mp4 -i audio_128k.m4a -map 0:v:0 -map 1:a:0 -shortest -acodec copy -vcodec copy -hls_time 2 -hls_list_size 0 -hls_flags single_file segment_3.m3u8
ffmpeg -y -threads 0 -i audio_128k.m4a -acodec copy -vcodec copy -hls_time 2 -hls_list_size 0 -hls_flags single_file segment_4.m3u8
# Transform MPD-Master-Playlist to M3U8-Master-Playlist
xsltproc --stringparam run_id "segment" /app/mpd-to-m3u8/mpd_to_hls.xsl playlist.mpd > playlist.m3u8
I am glad to receive any improvement ideas about this "any video to DASH/ HLS" pipeline. Especially if someone has any input on integrating better Apple's support of fragemented mp4 (fmp4) files in this pipeline.
Suggestions welcome. :)
Content-Type: application/dash+xmlmoov atom)output next to the transcoded video file.htaccess file including code ready for inclusion into the own website for playback next to all other created filesfluid-player.html) is based on the great work of the devs at Fluid Playerplyr.html) is based on the great work of the devs at Plyrvideogular.html) is based on the great work of the devs at Videogularindex.html) is based on the great work of the guys at Video.jsFor creating DASH/ HLS compatible files for multiple videos in a single run, please have a look at:
Content type
Image
Digest
sha256:c804a2b0e…
Size
60.2 MB
Last updated
over 3 years ago
docker pull majamee/alpine-dash-hls