fid-ffmpeg 0.3.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fid/__init__.py +0 -0
- fid/fid.py +71 -0
- fid_ffmpeg-0.3.5.dist-info/METADATA +33 -0
- fid_ffmpeg-0.3.5.dist-info/RECORD +8 -0
- fid_ffmpeg-0.3.5.dist-info/WHEEL +5 -0
- fid_ffmpeg-0.3.5.dist-info/entry_points.txt +2 -0
- fid_ffmpeg-0.3.5.dist-info/licenses/LICENSE +8 -0
- fid_ffmpeg-0.3.5.dist-info/top_level.txt +1 -0
fid/__init__.py
ADDED
|
File without changes
|
fid/fid.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import shutil
|
|
5
|
+
from welcome import welcome
|
|
6
|
+
app = typer.Typer()
|
|
7
|
+
|
|
8
|
+
formats = [".mp4",".mov",".avi",".webm"]
|
|
9
|
+
@app.callback(invoke_without_command=True)
|
|
10
|
+
def main(ctx: typer.context):
|
|
11
|
+
welcome()
|
|
12
|
+
if ctx_involved_subcommand id none:
|
|
13
|
+
print(oops!)
|
|
14
|
+
|
|
15
|
+
def ffmpeg():
|
|
16
|
+
if shutil.which("ffmpeg")is None:
|
|
17
|
+
print("ffmpeg isn't installed\n download from: https://ffmpeg.org/download.html")
|
|
18
|
+
raise typer.Exit()
|
|
19
|
+
|
|
20
|
+
def ckvideo(vid:Path):
|
|
21
|
+
if not vid.exists():
|
|
22
|
+
print("file doesn't exist")
|
|
23
|
+
raise typer.Exit()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.command()
|
|
27
|
+
def info(vid: Path):
|
|
28
|
+
ffmpeg()
|
|
29
|
+
ckvideo(vid)
|
|
30
|
+
subprocess.run(["ffprobe", "-v", "error", "-show_format", "-show_streams", str(vid)], check=True)
|
|
31
|
+
|
|
32
|
+
@app.command()
|
|
33
|
+
def audio(vid: Path):
|
|
34
|
+
ffmpeg()
|
|
35
|
+
ckvideo(vid)
|
|
36
|
+
audio=vid.with_suffix(".mp3")
|
|
37
|
+
subprocess.run(["ffmpeg", "-i", str(vid), "-vn", "-acodec", "mp3", "-y", str(audio)], check=True)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.command()
|
|
41
|
+
def frames(vid: Path):
|
|
42
|
+
ffmpeg()
|
|
43
|
+
ckvideo(vid)
|
|
44
|
+
Fdir= vid.parent
|
|
45
|
+
frames= Fdir / "Frames" / vid.stem
|
|
46
|
+
frames.mkdir(parents=True,exist_ok=True)
|
|
47
|
+
subprocess.run(["ffmpeg", "-i", str(vid),str(frames/ "frame_%02d.png")],check=True )
|
|
48
|
+
|
|
49
|
+
@app.command()
|
|
50
|
+
def gif(vid: Path):
|
|
51
|
+
ffmpeg()
|
|
52
|
+
ckvideo(vid)
|
|
53
|
+
gif=vid.with_suffix(".gif")
|
|
54
|
+
subprocess.run(["ffmpeg", "-i", str(vid), "-t", "3", "-vf", "scale=320:-1", "-y", str(gif)], check=True)
|
|
55
|
+
|
|
56
|
+
@app.command()
|
|
57
|
+
def mute(vid: Path):
|
|
58
|
+
ffmpeg()
|
|
59
|
+
ckvideo(vid)
|
|
60
|
+
mute=vid.with_stem(f"{vid.stem}_muted").with_suffix(vid.suffix)
|
|
61
|
+
subprocess.run(["ffmpeg", "-i", str(vid), "-c", "copy", "-an", "-y", str(mute)], check=True)
|
|
62
|
+
|
|
63
|
+
@app.command()
|
|
64
|
+
def compress(vid: Path, crf: int=28):
|
|
65
|
+
ffmpeg()
|
|
66
|
+
ckvideo(vid)
|
|
67
|
+
compress= vid.with_stem(f"{vid.stem}_compressed").with_suffix(".mkv")
|
|
68
|
+
subprocess.run(["ffmpeg", "-i", str(vid),"-c:v", "libx264", "-crf", str(crf), "-preset","medium","-c:a","aac","-b:a","96k","-y",str(compress),], check=True)
|
|
69
|
+
|
|
70
|
+
if __name__=="__main__":
|
|
71
|
+
app()
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fid-ffmpeg
|
|
3
|
+
Version: 0.3.5
|
|
4
|
+
Summary: based ffmpeg CLI for video operations
|
|
5
|
+
Author-email: omar_abdalgwad <ahlawyomar95@gmail.com>
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: typer>=0.7
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# fid-ffmpeg
|
|
12
|
+
simple ffmpeg based cli for video operations
|
|
13
|
+
|
|
14
|
+
## installation
|
|
15
|
+
|
|
16
|
+
- you need to install python >=3.9 : [Download Python](https://www.python.org/downloads/)
|
|
17
|
+
- install ffmpeg : [Download FFmpeg](https://www.ffmpeg.org/download.html)
|
|
18
|
+
- then install fid-cli with pip :
|
|
19
|
+
```bash
|
|
20
|
+
pip install fid-ffmpeg
|
|
21
|
+
```
|
|
22
|
+
## installation demo
|
|
23
|
+
https://github.com/user-attachments/assets/5c1bb2ac-1793-44b8-8240-bc71a1919d5a
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
| Command | Description |
|
|
27
|
+
|---------|------------|
|
|
28
|
+
| `fid --help` | show help for fid cli |
|
|
29
|
+
| `fid info "videoPath"` | `to know all info about the video` |
|
|
30
|
+
| `fid audio "videoPath"` | `extract audio from the video` |
|
|
31
|
+
| `fid mute "videoPath"` | `mute the video` |
|
|
32
|
+
| `fid gif "videoPath"` | `make a gif from the video` |
|
|
33
|
+
| `fid frames "videoPath"` | `extract all video frames and add them in a folder`|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
fid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
fid/fid.py,sha256=9Y5HWADNxrYK79RWnDkJN7XkWRs5F-h5jzGBYIQLVdY,2106
|
|
3
|
+
fid_ffmpeg-0.3.5.dist-info/licenses/LICENSE,sha256=8HFb3MtS3r_RTfGUr8mm6IbZocu4o4vc2f2U00Z3Tmc,255
|
|
4
|
+
fid_ffmpeg-0.3.5.dist-info/METADATA,sha256=LLji_Um5FZExJFeTJIBprPIr-myXKCuQhkDrLTcFXWs,1126
|
|
5
|
+
fid_ffmpeg-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
fid_ffmpeg-0.3.5.dist-info/entry_points.txt,sha256=wc8Iju3nkXAuyqF5NB1276l_AGtakuifMGR3D42dqB8,36
|
|
7
|
+
fid_ffmpeg-0.3.5.dist-info/top_level.txt,sha256=5jgogeo314G3j_oXUp3BE4wBE3t82ijRwLwF1KnYiDg,4
|
|
8
|
+
fid_ffmpeg-0.3.5.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fid
|