Fix: Resolve NameError in utils.py; Refactor: Switch to subprocess calls and update spec file; Docs: Mark packaging complete

This commit is contained in:
Ramforth
2025-11-01 12:37:32 +01:00
parent b8d74f43ef
commit 1fdaf49133
3 changed files with 8 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ Based on the "DaVinci Resolve 18 Supported Codec List.pdf" and web search result
5. **`ffmpeg` Execution:** Use `subprocess.run()` to execute the `ffmpeg` command, capturing stdout/stderr for logging.
6. **Error Handling:** Add `try-except` blocks for file operations, `subprocess` calls, and `ffprobe` parsing.
7. **Basic Testing:** Test with a few sample video files (e.g., H.264/AAC MP4) to ensure conversion to DNxHR/PCM MOV works.
8. **Packaging and Bundling:** Use PyInstaller (or similar) to create standalone executables for target operating systems. This step will involve bundling the Python script, its dependencies, and the `ffmpeg`/`ffprobe` binaries. Note that packaging will be OS-specific (e.g., a Linux executable must be built on Linux).
8. **Packaging and Bundling:** (Completed) Used PyInstaller to create a standalone executable, bundling `ffmpeg` and `ffprobe` binaries. This involved switching from `ffmpeg-python` to direct `subprocess` calls to resolve bundling issues. The executable is now functional.
9. **Error Handling for Bundled Tools:** Implement checks to ensure bundled `ffmpeg`/`ffprobe` are accessible and provide clear error messages if not.
## 6. Directory and File Structure

View File

@@ -3,10 +3,11 @@ import json
import subprocess
import sys
from src import config # Import config module
def get_video_info(file_path):
"""Uses ffprobe to get detailed information about a video file."""
command = [
'ffprobe',
config.FFPROBE_PATH,
'-v', 'error',
'-select_streams', 'v:0',
'-show_entries', 'stream=codec_name,width,height,avg_frame_rate,duration_ts,bit_rate,pix_fmt',
@@ -33,10 +34,10 @@ def get_video_info(file_path):
def get_audio_info(file_path):
"""Uses ffprobe to get detailed information about an audio stream in a video file."""
command = [
'ffprobe',
config.FFPROBE_PATH,
'-v', 'error',
'-select_streams', 'v:0',
'-show_entries', 'stream=codec_name,width,height,avg_frame_rate,duration_ts,bit_rate,pix_fmt',
'-select_streams', 'a:0',
'-show_entries', 'stream=codec_name,sample_rate,channels,bit_rate',
'-of', 'json',
file_path
]

View File

@@ -6,12 +6,11 @@ a = Analysis(['src/main.py'],
pathex=['/home/joe/Cloud9/Documents/Obisdian/projects/Video Converter'],
binaries=[('/usr/bin/ffmpeg', '.'), ('/usr/bin/ffprobe', '.')],
datas=[],
hiddenimports=['ffmpeg.nodes', 'ffmpeg._utils', 'ffmpeg._run'],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
collect_submodules=['ffmpeg'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,