[INIT] - push actual alpha
This commit is contained in:
@@ -1,3 +1,48 @@
|
||||
# dwm-anime-wallpaper
|
||||
|
||||
wallpaper animation using bmp file and feh app
|
||||
wallpaper animation using bmp file and feh app
|
||||
|
||||
## MP4 to BMP
|
||||
|
||||
take an mp4 video file (pay attention to the length of the video) and use ffmpeg to generate the bmp files. It is possible to manage the quality and number of frames generated.
|
||||
|
||||
### Manual convert
|
||||
|
||||
```bash
|
||||
File=[absolute path of mp4 file]
|
||||
BaseFile=$(echo ${File} | sed 's/\.mp4//g')
|
||||
mkdir ${HOME}/$(xdg-user-dir PICTURES)/dwm-anime-wallpaper/${BaseFile}
|
||||
ffmpeg -i ${File} -pix_fmt bgr8 ${BaseFile}/${BaseFile}_%04d.bmp
|
||||
```
|
||||
|
||||
### Tools
|
||||
|
||||
In the repository you will find a script which does essentially the same thing as the manual chapter work
|
||||
|
||||
* mp4tobmp.sh
|
||||
|
||||

|
||||
|
||||
## Launch
|
||||
|
||||
Main process
|
||||
|
||||
```bash
|
||||
./dwm-anime-wallpaper.sh
|
||||
```
|
||||
|
||||
Test with arg (to preview a specific foleder)
|
||||
|
||||
```bash
|
||||
./dwm-anime-wallpaper.sh [DIR]
|
||||
```
|
||||
|
||||
## Preview
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 MiB |
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
SwitchTime=60
|
||||
DirAnime=$(xdg-user-dir PICTURES)/dwm-anime-wallpaper/
|
||||
|
||||
while true
|
||||
do
|
||||
|
||||
[[ ! -z ${1} ]] && RDir=$(ls -1 ${DirAnime}| grep ${1}) || RDir=$(ls -1 ${DirAnime} | sort -R | head -n1)
|
||||
Adate=$(date +%s)
|
||||
for Img in $(find "${DirAnime}"/"${RDir}"/ -name *.bmp | sort -n)
|
||||
do
|
||||
feh --bg-scale "${Img}"
|
||||
sleep 0.01
|
||||
Pdate=$(date +%s)
|
||||
[[ ${SwitchTime} -lt $((Pdate-Adate)) ]] && break
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 161 KiB |
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Set color
|
||||
Red="\e[31m"
|
||||
Green="\e[32m"
|
||||
Yellow="\e[33m"
|
||||
NoColor="\e[0m"
|
||||
|
||||
|
||||
## help
|
||||
Usage(){
|
||||
|
||||
echo "$(basename "${0}") [mp4 file path]"
|
||||
exit
|
||||
}
|
||||
|
||||
Action () {
|
||||
|
||||
echo -ne "$1 : "
|
||||
shift
|
||||
ResStdout=$("${@}" 2> /dev/null)
|
||||
Res=$?
|
||||
if [[ ${Res} -eq 0 ]]
|
||||
then
|
||||
echo -e "[${Green}OK${NoColor}] ${ResStdout}"
|
||||
else
|
||||
if [[ ${Res} -eq 255 ]]
|
||||
then
|
||||
echo -e "[${Yellow}N/A${NoColor}] ${ResStdout}"
|
||||
else
|
||||
echo -e "[${Red}Failed${NoColor}] ${ResStdout}"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
CheckFile() {
|
||||
Return=0
|
||||
[[ ! -e ${File} ]] && ((Return++))
|
||||
file "${File}"| grep -q "ISO Media, MP4 v2"
|
||||
Res=${?}
|
||||
[[ ${Res} -ne 0 ]] && ((Return++))
|
||||
return "${Return}"
|
||||
}
|
||||
|
||||
CreateEnv() {
|
||||
if [[ ! -d "${BaseDir}" ]]
|
||||
then
|
||||
mkdir -p "${BaseDir}"
|
||||
Return=$?
|
||||
else
|
||||
Return=1
|
||||
echo " - Directory \"${BaseDir}\" exist"
|
||||
fi
|
||||
return "${Return}"
|
||||
}
|
||||
|
||||
Generate() {
|
||||
ffmpeg -i "${File}" -pix_fmt bgr8 "${BaseDir}"/"${BaseName}"_%04d.bmp &> /dev/null
|
||||
Res=${?}
|
||||
if [[ "${Res}" -eq 0 ]]
|
||||
then
|
||||
Return=0
|
||||
echo "- $(find "${BaseDir}" -name "*.bmp" | wc -l) Files generated"
|
||||
else
|
||||
Return=1
|
||||
rm -Rf "${BaseDir}"
|
||||
echo " - FFmpeg FAILED - ${BaseDir} deleted"
|
||||
fi
|
||||
return ${Return}
|
||||
}
|
||||
|
||||
[[ -z $1 ]] && Usage
|
||||
|
||||
# Env
|
||||
File=$(realpath "${1}")
|
||||
BaseName=$(basename "${1}" | sed 's/\.mp4$//g')
|
||||
BaseDir="$(xdg-user-dir PICTURES)/dwm-anime-wallpaper/${BaseName}"
|
||||
|
||||
# Main
|
||||
Action "Check File" CheckFile
|
||||
Action "Create Env" CreateEnv
|
||||
Action "Generate bmp files" Generate
|
||||
Reference in New Issue
Block a user