Skip to content

Commit

Permalink
Add interlaced video handling
Browse files Browse the repository at this point in the history
In the `disc.py` and `video.py` modules, a new feature to handle interlaced video was added. A new attribute `is_interlaced` was introduced in the DiscInfo class. It's value will be True if field order is not progressive. In the video module, if the video is interlaced, an `ffmpeg` filter is applied to handle interlaced video formats.
  • Loading branch information
cbusillo committed Jun 16, 2024
1 parent d139127 commit eeffcde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bd_to_avp/modules/disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class DiscInfo:
resolution: str = "1920x1080"
color_depth: int = 8
main_title_number: int = 0
is_interlaced: bool = False


def get_disc_and_mvc_video_info() -> DiscInfo:
Expand All @@ -34,6 +35,8 @@ def get_disc_and_mvc_video_info() -> DiscInfo:
disc_info.resolution = f"{ffmpeg_probe_output.get('width', 1920)}x{ffmpeg_probe_output.get('height',1080)}"
disc_info.frame_rate = ffmpeg_probe_output.get("avg_frame_rate")
disc_info.color_depth = 10 if "10" in ffmpeg_probe_output.get("pix_fmt") else 8
if ffmpeg_probe_output.get("field_order") != "progressive":
disc_info.is_interlaced = True
return disc_info

command = [config.MAKEMKVCON_PATH, "--robot", "info", source]
Expand Down
4 changes: 4 additions & 0 deletions bd_to_avp/modules/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def generate_ffmpeg_wrapper_command(
)
if crop_params:
stream = ffmpeg.filter(stream, "crop", *crop_params.split(":"))

if disc_info.is_interlaced:
stream = ffmpeg.filter(stream, "bwdif")

stream = ffmpeg.output(
stream,
f"file:{output_path}",
Expand Down

0 comments on commit eeffcde

Please sign in to comment.