This commit is contained in:
Shaun Kruger
2026-11-22 14:50:09 -07:00
parent d29b0f3162
commit 9a02298361
17 changed files with 2 additions and 171 deletions
+2
View File
@@ -8,3 +8,5 @@ storage/
**.pyc **.pyc
__pycache__/ __pycache__/
*.db
-10
View File
@@ -1,10 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
-26
View File
@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="transcoding" uuid="eb5b1d39-d6f8-4807-b782-63a11277ebd3">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/transcoding.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="identifier.sqlite" uuid="0e87cf42-28f9-40ab-98e0-aa7924153ae7">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:identifier.sqlite</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="transcoding [krugertest]" uuid="27f649a9-59e9-4fb8-a3bb-c02067acf837">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/krugertest/transcoding.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="db-forest-configuration">
<data version="2">.
----------------------------------------
1:0:eb5b1d39-d6f8-4807-b782-63a11277ebd3
2:0:0e87cf42-28f9-40ab-98e0-aa7924153ae7
3:0:27f649a9-59e9-4fb8-a3bb-c02067acf837
.</data>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="~/PycharmProjects/privatestudio/.venv" project-jdk-type="Python SDK" />
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/privatestudio.iml" filepath="$PROJECT_DIR$/.idea/privatestudio.iml" />
</modules>
</component>
</project>
Binary file not shown.
Binary file not shown.
-59
View File
@@ -1,59 +0,0 @@
Metadata-Version: 2.4
Name: privatestudio
Version: 0.2.dev1+g72b4fcc10.d20261026
Summary: Video transcoding tools with multi-profile H.264 encoding support
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: PyYAML>=6.0
Requires-Dist: FastAPI>=0.100.0
Requires-Dist: uvicorn[standard]>=0.23.0
Requires-Dist: SQLAlchemy>=2.0.0
Requires-Dist: python-multipart>=0.0.5
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"
To output individual MP4 files for subsequent Bento4 packaging, you need to ensure the video streams are perfectly aligned. This requires forcing fixed GOP sizes (Keyframe intervals) and disabling scene-change detection.
The FFmpeg Command
This command takes input.mp4 and splits it into three separate, fragmented-friendly MP4 files (1080p, 720p, and 480p) plus one standalone audio track:
```bash
ffmpeg -y -i input.mp4 \
-map 0:v:0 -map 0:v:0 -map 0:v:0 -map 0:a:0 \
-g 72 -keyint_min 72 -sc_threshold 0 \
-c:v:0 libx264 -b:v:0 5000k -maxrate:v:0 5350k -bufsize:v:0 7500k -filter:v:0 "scale=-2:1080" -an output_1080p.mp4 \
-c:v:1 libx264 -b:v:1 2800k -maxrate:v:1 2996k -bufsize:v:1 4200k -filter:v:1 "scale=-2:720" -an output_720p.mp4 \
-c:v:2 libx264 -b:v:2 1400k -maxrate:v:2 1498k -bufsize:v:2 2100k -filter:v:2 "scale=-2:480" -an output_480p.mp4 \
-c:a aac -b:a 128k -vn output_audio.mp4
```
## Critical Settings for Bento4
* -g 72 -keyint_min 72: Forces a keyframe exactly every 72 frames. At 24fps, this yields an exact 3-second fragment duration.
* -sc_threshold 0: Disables adaptive scene-change keyframes. Without this, your streams will have misaligned keyframes, and Bento4 will fail to package them as a single adaptive HLS stream.
* -an and -vn: Separates the audio from the video files. Bento4 handles multiplexing and packaging best when audio and video tracks are fed as distinct source files.
# Configuring for quicksync
1:N transcoding workflow that leverages the GPU hardware filter scale_qsv. This reads the input frame once, scales it on the Intel GPU, and encodes both outputs simultaneously.
```bash
ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 \
-filter_complex "[0:v]split=2[s1][s2]; \
[s1]scale_qsv=w=1280:h=720[v720]; \
[s2]scale_qsv=w=854:h=480[v480]" \
-map "[v720]" -c:v h264_qsv -b:v 2500k -maxrate 2500k -bufsize 5000k \
-g 60 -keyint_min 60 -sc_threshold 0 -forced-idr 1 -an video_720p.mp4 \
-map "[v480]" -c:v h264_qsv -b:v 1000k -maxrate 1000k -bufsize 2000k \
-g 60 -keyint_min 60 -sc_threshold 0 -forced-idr 1 -an video_480p.mp4 \
-map 0:a? -c:a aac -b:a 128k audio.mp4
```
Key Argument Explanations:
* -hwaccel qsv -c:v h264_qsv: Invokes hardware decoding and initialization.
* scale_qsv=w=...:h=...: Tells the Intel GPU to handle the video resizing directly inside the Quick Sync processing pipeline.
* -g 60 -keyint_min 60: Dictates the GOP size (assuming a 30fps input video, a GOP of 60 forces a keyframe exactly every 2 seconds).
* -sc_threshold 0: Disables scene change detection to ensure keyframes are purely fixed.
* -forced-idr 1: Forces the QSV encoder to use actual IDR frames instead of basic I-frames at the GOP boundary, which is necessary for fragmenting tools.
* -an: Strips audio out of the video streams so Bento4 can package them as clean, isolated tracks.
-15
View File
@@ -1,15 +0,0 @@
notes.md
pyproject.toml
privatestudio/__init__.py
privatestudio/_version.py
privatestudio/transcode.py
privatestudio.egg-info/PKG-INFO
privatestudio.egg-info/SOURCES.txt
privatestudio.egg-info/dependency_links.txt
privatestudio.egg-info/entry_points.txt
privatestudio.egg-info/requires.txt
privatestudio.egg-info/scm_file_list.json
privatestudio.egg-info/scm_version.json
privatestudio.egg-info/top_level.txt
profiles/default.yaml
tests/test_web.py
@@ -1 +0,0 @@
-3
View File
@@ -1,3 +0,0 @@
[console_scripts]
ps-serve = privatestudio.web.cli:main
ps-transcode = privatestudio.transcode:main
-10
View File
@@ -1,10 +0,0 @@
PyYAML>=6.0
FastAPI>=0.100.0
uvicorn[standard]>=0.23.0
SQLAlchemy>=2.0.0
python-multipart>=0.0.5
[dev]
pytest>=7.0
pytest-cov>=4.0
httpx>=0.27.0
@@ -1,9 +0,0 @@
{
"files": [
"notes.md",
"privatestudio/__init__.py",
"privatestudio/transcode.py",
"profiles/default.yaml",
"pyproject.toml"
]
}
-8
View File
@@ -1,8 +0,0 @@
{
"tag": "0.1",
"distance": 1,
"node": "g72b4fcc1071dc2a9395829c3e8ac257cfd93a127",
"dirty": true,
"branch": "main",
"node_date": "2026-10-26"
}
-1
View File
@@ -1 +0,0 @@
privatestudio