mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 03:16:22 -05:00
Transcode modal: allow a container-only remux
Keeping both streams is no longer refused: ffmpeg copies them into the chosen container with fast start. The container select starts at the file's own container, the hint explains what a remux does, and the button reads Remux when nothing is re-encoded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
ca1dc82aa9
commit
749d5ac32b
5 changed files with 100 additions and 22 deletions
|
|
@ -133,8 +133,8 @@ async def transcode_video_file(video_path: pathlib.Path,
|
|||
"""
|
||||
if not FFMPEG_BIN:
|
||||
raise RuntimeError('ffmpeg was not found')
|
||||
if not target_vcodec and not target_acodec:
|
||||
raise RuntimeError('Refusing to transcode without a target codec')
|
||||
# No target for either stream is a remux: both streams are copied into the (new) container
|
||||
# with faststart. Cheap, and what a user wants when only the container is wrong.
|
||||
if container not in TRANSCODE_CONTAINERS:
|
||||
logger.info(f'Forcing mp4 container for transcode of {video_path} ({container} is not supported)')
|
||||
container = 'mp4'
|
||||
|
|
@ -250,9 +250,7 @@ async def _transcode_video_file(video_path: pathlib.Path, target_vcodec: Optiona
|
|||
|
||||
|
||||
def validate_transcode_request(video_codec: Optional[str], audio_codec: Optional[str], container: str):
|
||||
"""@raise ValueError: when the request cannot be transcoded."""
|
||||
if not video_codec and not audio_codec:
|
||||
raise ValueError('At least one of video_codec or audio_codec is required')
|
||||
"""@raise ValueError: when the request cannot be transcoded. No codec at all is a remux."""
|
||||
if video_codec and video_codec not in TRANSCODE_VIDEO_TARGETS:
|
||||
raise ValueError(f'Cannot transcode video to {video_codec!r}; supported: {sorted(TRANSCODE_VIDEO_TARGETS)}')
|
||||
if audio_codec and audio_codec not in TRANSCODE_AUDIO_TARGETS:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue