Skip to content

Commit a6bea08

Browse files
committed
first commit
0 parents  commit a6bea08

6 files changed

Lines changed: 889 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.aur

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## v0.1.0
2+
**Release date: 2023-12-22**
3+
- First release

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
all:
2+
@echo "Installing: sudo make install"
3+
@echo "Uninstalling: sudo make uninstall"
4+
5+
install:
6+
@chmod 755 davinconv
7+
@cp davinconv /usr/bin/davinconv
8+
@echo "Davinconv has been installed"
9+
10+
uninstall:
11+
@rm -rf /usr/bin/davinconv
12+
@echo "Davinconv has been uninstalled"

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Davinconv - video converter for Davinci Resolve on Linux
2+
Simple script written in bash to convert videos using `ffmpeg` to the format supported by Davinci Resolve for Linux.
3+
4+
I recommend watching [tihs video](https://www.youtube.com/watch?v=WLcW4UWPC5Y) before using the script.
5+
## Installing
6+
### Install Davinconv manually with `make`
7+
- First, download and install `git` and `make` usnig your **package manager**.
8+
- Then, clone the repo:
9+
```
10+
git clone https://github.com/gohny/davinconv
11+
```
12+
- Change current directory to `davinconv`:
13+
```
14+
cd davinconv
15+
```
16+
- Install:
17+
```
18+
sudo make install
19+
```
20+
### Install Davinconv with AUR
21+
https://aur.archlinux.org/packages/davinconv
22+
#### Using AUR helper such as `yay` or `pikaur`
23+
- Simply install the `davinconv` package using your **AUR helper**.
24+
- ##### `yay`:
25+
```
26+
yay davinconv
27+
```
28+
- ##### `pikaur`:
29+
```
30+
pikaur -S davinconv
31+
```
32+
#### Manually, using `makepkg` script
33+
- Install `git`:
34+
```
35+
sudo pacman -S git
36+
```
37+
- Clone the repo from **AUR**:
38+
```
39+
git clone https://aur.archlinux.org/davinconv.git
40+
```
41+
- Change current directory to `davinconv`:
42+
```
43+
cd davinconv
44+
```
45+
- Install:
46+
```
47+
makepkg -si
48+
```
49+
## Uninstalling
50+
### Using `make`
51+
- If you're missing repo files, clone it again:
52+
```
53+
git clone https://github.com/gohny/davinconv
54+
```
55+
- Change current directory to `davinconv`:
56+
```
57+
cd davinconv
58+
```
59+
- Uninstall:
60+
```
61+
sudo make uninstall
62+
```
63+
### AUR
64+
- Uninstall `davinconv` with `pacman`:
65+
```
66+
sudo pacman -Rsnu davinconv
67+
```
68+
## Usage
69+
```
70+
Usage: davinconv [-c|C|e|E|h|R]
71+
72+
Options:
73+
{-c} [file] - Convert video to the MJPEG codec that can be read by Davinci Resolve.
74+
{-C} - Convert all videos in current directory to the MJPEG codec that can be read by Davinci Resolve.
75+
{-e} [file] - Export converted video back to the H264 codec.
76+
{-E} - Export all converted videos stored in ~/Videos/davinconv/converted back to the H264 codec.
77+
{-h} - Display this message.
78+
{-R} - Remove all converted videos stored in ~/Videos/davinconv/converted. - Remove all converted videos stored in ~/Videos/davinconv/converted.
79+
```
80+
### Files
81+
**Converted** videos are stored in: `~/Videos/davinconv/` <br/>
82+
***
83+
Created by Gohny

davinconv

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#! /bin/bash
2+
VERSION=0.1.0
3+
USERNAME=$(whoami)
4+
VIDDIR=/home/"$USERNAME"/Videos/davinconv
5+
WHEREAMI=$(pwd)
6+
7+
if [ ! -d "$VIDDIR" ]; then
8+
mkdir -p "$VIDDIR"
9+
mkdir -p "$VIDDIR"/converted
10+
mkdir -p "$VIDDIR"/exported
11+
fi
12+
13+
Help() {
14+
echo ""
15+
echo " ............................................................"
16+
echo " . Davinconv - video converter for Davinci Resolve on Linux ."
17+
echo " . v0.1.0 by Gohny ."
18+
echo " ............................................................"
19+
echo ""
20+
echo "Usage: davinconv [-c|C|e|E|h|R]"
21+
echo ""
22+
echo "Options:"
23+
echo " {-c} [file] - Convert video to the MJPEG codec that can be read by Davinci Resolve."
24+
echo " {-C} - Convert all videos in current directory to the MJPEG codec that can be read by Davinci Resolve."
25+
echo " {-e} [file] - Export converted video back to the H264 codec."
26+
echo " {-E} - Export all converted videos stored in $VIDDIR/converted back to the H264 codec."
27+
echo " {-h} - Display this message."
28+
echo " {-R} - Remove all converted videos stored in $VIDDIR/converted."
29+
echo ""
30+
echo "All converted and exported videos are stored in: ~/Videos/davinconv"
31+
echo ""
32+
echo "It is recommended to watch https://www.youtube.com/watch?v=WLcW4UWPC5Y before using the script."
33+
echo ""
34+
echo "LICENSE: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007"
35+
echo "https://github.com/gohny/davinconv"
36+
}
37+
38+
Convert() {
39+
ffmpeg -i "$i" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov "$VIDDIR"/converted/${i%.*}.mov
40+
}
41+
42+
ConvertAll() {
43+
for i in *.mp4 *.mkv; do
44+
ffmpeg -i "$i" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov "$VIDDIR"/converted/${i%.*}.mov
45+
done
46+
}
47+
48+
Export() {
49+
ffmpeg -i "$VIDDIR"/converted/"$i" -c:v libx264 -preset ultrafast -crf 0 "$VIDDIR"/exported/${i%.*}.mp4
50+
}
51+
52+
ExportAll() {
53+
cd "$VIDDIR"/converted
54+
for i in *.mov; do
55+
ffmpeg -i "$i" -c:v libx264 -preset ultrafast -crf 0 "$VIDDIR"/exported/${i%.*}.mp4
56+
done
57+
cd "$WHEREAMI"
58+
}
59+
60+
RemoveAll() {
61+
62+
while true; do
63+
64+
echo "You are about to remove ALL converted videos stored in $VIDDIR/converted."
65+
read -p "Do you want to continue? (y/n) " yn
66+
67+
case $yn in
68+
[yY] )
69+
echo ""
70+
echo "please wait..."
71+
echo ""
72+
sleep 1
73+
rm -rf "$VIDDIR"/converted/*
74+
break;;
75+
76+
[nN] )
77+
echo "No changes have been made."
78+
exit;;
79+
80+
* )
81+
echo "Error: please input y or n";;
82+
esac
83+
done
84+
}
85+
86+
while getopts ":c:Ce:EhR" OPTION; do
87+
case $OPTION in
88+
c)
89+
i=${OPTARG}
90+
Convert
91+
exit;;
92+
C)
93+
ConvertAll
94+
exit;;
95+
e)
96+
i=${OPTARG}
97+
Export
98+
exit;;
99+
E)
100+
ExportAll
101+
exit;;
102+
h)
103+
Help
104+
exit;;
105+
R)
106+
RemoveAll
107+
exit;;
108+
*)
109+
echo "Error: Invalid option or argument not provided!"
110+
echo "For help use: davinconv -h"
111+
exit;;
112+
esac
113+
done
114+
115+
Help
116+
exit

0 commit comments

Comments
 (0)