chore(ffmpeg): add source

This commit is contained in:
Michele Cereda
2024-05-04 12:44:14 +02:00
parent 1cb64d4675
commit 7cde936892
4 changed files with 21 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ override venv ?= ${shell git rev-parse --show-toplevel}/.venv
create-venv: override python_version ?= 3.12 create-venv: override python_version ?= 3.12
create-venv: ${shell which 'python${python_version}'} create-venv: ${shell which 'python${python_version}'}
@python${python_version} -m 'venv' '${venv}' @python${python_version} -m 'venv' '${venv}'
@${venv}/bin/pip --require-virtualenv install -U -r 'requirements.txt' @${venv}/bin/pip --require-virtualenv install -r 'requirements.txt'
recreate-venv: recreate-venv:
@rm -r '${venv}' @rm -r '${venv}'

View File

@@ -1,10 +1,9 @@
# ffmpeg # ffmpeg
## Table of contents <!-- omit in toc -->
1. [TL;DR](#tldr) 1. [TL;DR](#tldr)
1. [Format conversion](#format-conversion) 1. [Format conversion](#format-conversion)
1. [Webm to GIF](#webm-to-gif) 1. [WebM to GIF](#webm-to-gif)
1. [WebM to MP4](#webm-to-mp4)
1. [Sources](#sources) 1. [Sources](#sources)
## TL;DR ## TL;DR
@@ -17,7 +16,7 @@ ffmpeg -y -i 'rec.webm' -i 'palette.png' -filter_complex 'paletteuse' -r 10 'out
## Format conversion ## Format conversion
### Webm to GIF ### WebM to GIF
```sh ```sh
ffmpeg -y -i 'rec.webm' -vf 'palettegen' 'palette.png' ffmpeg -y -i 'rec.webm' -vf 'palettegen' 'palette.png'
@@ -25,12 +24,21 @@ ffmpeg -y -i 'rec.webm' -i 'palette.png' -filter_complex 'paletteuse' -r 10 'out
``` ```
Here `rec.webm` is the recorded video.<br/> Here `rec.webm` is the recorded video.<br/>
The first command creates a palette out of the webm file. The second command converts the webm file to gif using the created palette. The first command creates a palette out of the webm file. The second command converts the webm file to gif using the
created palette.
### WebM to MP4
```sh
ffmpeg -i 'input.webm' -c 'copy' 'output.mp4'
ffmpeg -fflags '+genpts' -r '24' -i 'input.webm' 'output.mp4'
```
## Sources ## Sources
- [Convert a webm file to gif] - [Convert a webm file to gif]
- [How to convert a webm video to a gif on the command line] - [How to convert a webm video to a gif on the command line]
- [WebM to MP4 conversion using ffmpeg]
<!-- <!--
References References
@@ -39,3 +47,4 @@ The first command creates a palette out of the webm file. The second command con
<!-- Others --> <!-- Others -->
[convert a webm file to gif]: https://mundanecode.com/posts/convert-webm-to-gif [convert a webm file to gif]: https://mundanecode.com/posts/convert-webm-to-gif
[how to convert a webm video to a gif on the command line]: https://askubuntu.com/questions/506670/how-to-do-i-convert-an-webm-video-to-a-animated-gif-on-the-command-line [how to convert a webm video to a gif on the command line]: https://askubuntu.com/questions/506670/how-to-do-i-convert-an-webm-video-to-a-animated-gif-on-the-command-line
[webm to mp4 conversion using ffmpeg]: https://stackoverflow.com/questions/18123376/webm-to-mp4-conversion-using-ffmpeg

View File

@@ -1,6 +1,6 @@
{ {
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^19.2.2", "@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2" "@commitlint/config-conventional": "^19.2.2"
} }
} }

View File

@@ -1,8 +1,12 @@
#!sh #!/usr/bin/env sh
# svg to png # svg to png
rsvg-convert -ah '96' 'icon.svg' -o 'icon-96.png' rsvg-convert -ah '96' 'icon.svg' -o 'icon-96.png'
# webm to gif
ffmpeg -y -i 'rec.webm' -vf 'palettegen' 'palette.png'
ffmpeg -y -i 'rec.webm' -i 'palette.png' -filter_complex 'paletteuse' -r 10 'out.gif'
# webm to mp4 # webm to mp4
ffmpeg -i 'input.webm' -c 'copy' 'output.mp4' ffmpeg -i 'input.webm' -c 'copy' 'output.mp4'
ffmpeg -fflags '+genpts' -r '24' -i 'input.webm' 'output.mp4' ffmpeg -fflags '+genpts' -r '24' -i 'input.webm' 'output.mp4'