42 lines
1.1 KiB
HTML
42 lines
1.1 KiB
HTML
{{ $extensions := .Get "extensions" }}
|
|
{{ $src := .Get "src" }}
|
|
|
|
<video width="480" height="320" controls>
|
|
{{ range split $extensions "," }}
|
|
<source src="{{ $src }}.{{ . }}">
|
|
{{ end }}
|
|
<div class="video">
|
|
|
|
Your browser does not support HTML5 video.
|
|
|
|
<ul>
|
|
{{ range split $extensions "," }}
|
|
<li>
|
|
<a href="{{ $src }}.{{ . }}">{{ $src }}.{{ . }}</a>
|
|
{{ $filename := . | printf "/static%s.%s" $src }}
|
|
{{ $stat := os.Stat $filename }}
|
|
({{ div $stat.Size 1024 }} kiB)
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
|
|
</div>
|
|
</video>
|
|
{{/*
|
|
MP4 and Webm formats are preferred.
|
|
|
|
Convert to MP4:
|
|
ffmpeg -i input.mkv -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac output.mp4 -hide_banner
|
|
|
|
Convert to Webm:
|
|
ffmpeg -i input.mkv -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 128k -c:a libopus output.webm
|
|
|
|
## Usage:
|
|
Put the video files into `/static/videos` folder.
|
|
Than include this file with its name and available extensions.
|
|
{{< video src="/videos/<video-file-name-without-extension>" extensions="<comma_separated_list_of_extensions>" >}}
|
|
|
|
## Example:
|
|
{{< video src="/videos/example" extensions="mp4,webm" >}}
|
|
*/}}
|