fix(video): transcode audio to AAC for MP4 streaming (PCM unsupported in MP4)
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -150,14 +150,15 @@ def local_video_file():
|
||||
except FileNotFoundError:
|
||||
return jsonify(error=f"Local video not found: {relative_path}"), 404
|
||||
|
||||
# Stream via ffmpeg: copy streams into an MP4 container with moov atom first
|
||||
# so browsers can start playback immediately without downloading the whole file.
|
||||
# Stream via ffmpeg: copy video, transcode audio to AAC (PCM not supported
|
||||
# in MP4), output as fragmented MP4 so browser plays without full download.
|
||||
def generate_stream():
|
||||
cmd = [
|
||||
"ffmpeg", "-nostdin", "-loglevel", "error",
|
||||
"-i", path,
|
||||
"-c", "copy", # no re-encode, just remux
|
||||
"-movflags", "frag_keyframe+empty_moov+faststart",
|
||||
"-c:v", "copy",
|
||||
"-c:a", "aac",
|
||||
"-movflags", "frag_keyframe+empty_moov",
|
||||
"-f", "mp4",
|
||||
"pipe:1",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user