-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reencode the media as webm hevc and av1 for smaller files
Signed-off-by: MTRNord <[email protected]>
- Loading branch information
Showing
23 changed files
with
55 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
pushd static/blog/img | ||
|
||
rm -r av1 | ||
rm -r hevc | ||
mkdir av1 | ||
mkdir hevc | ||
|
||
for i in *.{mp4,m4v,webm,mov}; | ||
do | ||
name=`echo "$i" | cut -d'.' -f1` | ||
echo "Converting ${name}" | ||
ffmpeg -i "$i" -map 0:v -c:v libsvtav1 -g 240 -b:v 4M -svtav1-params pass=0:lookahead=42:scd=1:film-grain=0:lp=4 -preset 5 -map "0:a?" -af aformat=channel_layouts="7.1|5.1|stereo" -c:a libopus -map "0:s?" -c:s copy -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "./av1/${name}.webm" | ||
ffmpeg -i "$i" -map_metadata -1 -c:a libopus -c:v libx265 -crf 24 -preset veryslow -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "./hevc/${name}.mp4" | ||
done | ||
|
||
popd |
Binary file added
BIN
+1.09 MB
static/blog/img/av1/164530391-e8b17ecd-a4d0-4ef8-a8b7-81230c1773d3.webm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+706 KB
static/blog/img/av1/d69a43a600530d78b3d40b6f86fd243e1c593ac11811820576617005056.webm
Binary file not shown.
Binary file added
BIN
+535 KB
static/blog/img/hevc/164530391-e8b17ecd-a4d0-4ef8-a8b7-81230c1773d3.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+226 KB
static/blog/img/hevc/d69a43a600530d78b3d40b6f86fd243e1c593ac11811820576617005056.mp4
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{%- set av1_filename = vid | regex_replace(pattern=`\..+`, rep=`.webm`) | replace(from='/blog/img/', to='/blog/img/av1/') -%} | ||
{%- set hevc_filename = vid | regex_replace(pattern=`\..+`, rep=`.mp4`) | replace(from='/blog/img/', to='/blog/img/hevc/') -%} | ||
<figure> | ||
<video controls preload="auto"> | ||
<source src="{{ av1_filename }}" type="video/webm"> | ||
<source src="{{ hevc_filename }}" type="video/mp4"> | ||
<source src="{{ vid }}" type="video/mp4"> | ||
Your browser does not support the video tag. | ||
</video> | ||
<figcaption>{{ caption | markdown | safe }}</figcaption> | ||
</figure> | ||
</figure> |