diff --git a/video-encoding.md b/video-encoding.md new file mode 100644 index 0000000..c019769 --- /dev/null +++ b/video-encoding.md @@ -0,0 +1,56 @@ +https://www.reddit.com/r/ffmpeg/comments/1g4higt/best_settings_for_converting_a_bluray_rip/ + +## gemini answer... + +Ripping Blu-ray movies on Linux for archiving with maximum quality and all subtitles is best achieved by combining +MakeMKV (to bypass encryption and extract raw streams) with FFmpeg (to transcode to a smaller, efficient format like HEVC) or simply using MakeMKV to create a "remux" (lossless copy). + +### Prerequisite: Install Tools +``` +sudo apt update +sudo apt install makemkv-bin makemkv-oss ffmpeg mkvtoolnix +``` + +### Step 1: Rip/Decrypt the Raw Movie (MakeMKV) +For maximum quality, you want to get the raw video (usually MPEG-4 AVC or VC-1) and audio (DTS-HD/TrueHD) off the disc without quality loss. + +* Run makemkv and select your Blu-ray drive. +* Click the "Open Blu-ray disc" button. +* Select the main movie title (largest file size, usually 30-50GB). +* Expand the title and ensure all audio tracks and all subtitle tracks are checked. +* Set the output folder and click "Make MKV". +* Result: A massive .mkv file with original audio/video/subtitles. + +### Step 2: Transcode for Archiving (FFmpeg - HEVC/H.265) +For archiving, HEVC (x265) offers the best quality-to-size ratio. This command preserves all subtitles and audio tracks, while heavily compressing the video without noticeable quality loss. +Command: + +``` +ffmpeg -i input_bluray.mkv \ +-map 0:v -c:v libx265 -crf 18 -preset slow -pix_fmt yuv420p10le \ +-map 0:a -c:a copy \ +-map 0:s -c:s copy \ +output_archive.mkv +``` + +**Explanation of Settings for Highest Quality:** + +* -map 0:v -map 0:a -map 0:s: Ensures all video, audio, and subtitle streams are included. +* -c:v libx265 -crf 18: Uses H.265 for compression. CRF 18 is visually lossless (lower numbers = higher quality, 17-18 is recommended for archiving). +* -preset slow: Allows the encoder more time to optimize compression, crucial for high quality. +* -pix_fmt yuv420p10le: Ensures 10-bit color, preventing color banding in dark scenes (10-bit looks better even on 8-bit sources). +* -c:a copy -c:s copy: Copies audio and subtitles directly without transcoding, preserving all original formats and forced subtitles. + +### Alternative: Lossless "Remux" (Best for Space-is-no-object) +If you do not want to re-encode the video and want a 1:1 copy, you can simply use mkvmerge (part of mkvtoolnix) to remux the MakeMKV output to ensure it is in a standard MKV container. This keeps the video in its original, uncompressed state. +bash + +``` +mkvmerge -o archive_remux.mkv input_bluray.mkv +``` + +Key Considerations + +* Subtitles: PGS subtitles (Blu-ray default) are often large. If you need to play them on devices that don't support PGS, you can use subtitle2ass or Subtitle Edit (via Wine) to OCR them to SRT later. +* Forced Subtitles: MakeMKV usually identifies forced subtitles (for foreign scenes) as a separate small track. +* 4K UHD HDR: If ripping 4K, ensure your version of FFmpeg supports HDR (4.4+). You may need to map tone-mapping filters to retain accurate colors if transcoding, but copying (-c:v copy) is better for 4K. \ No newline at end of file