View Single Post
Old 18th July 2016, 08:45   #1051  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Quote:
Originally Posted by Polar View Post
Just one more question: is there a way to convert HSBS files to FS? Looks like the software only can work with ISO or 3D-MKV (where the last one requires the 3D file created by MakeMKV). What if I do not have the required extra file? Did some playing around by downloading some 3D SBS test files, but no go . Any advice?
As promised, here is a little avisynth script to help you convert Half or Full SBS or T&B to Frame Sequential:
Code:
# SBSorTAB2FS.avs v1.0 by r0lZ, July 18, 2016
# Avisynth script to convert a 3D clip from Full or Half SBS or T&B to 720p or 1080p frame sequential
# Requires the FFMpegSource2 avisynth plugin: http://avisynth.nl/index.php/FFmpegSource
# Usage: Copy this script in the directory containing the source clip, and edit the settings below to suit your needs.
# Encode the script using a good x264 or x265 frontend, and mux with MkvToolnix GUI.
# Don't forget the very important x264 option --frame-packing 5
# Select the stereography mode 13: both eyes laced in one block (left first) for the video stream in MkvToolnix GUI.

# Edit the settings below:

# Source clip file name.  If the AVS script is not in the same directory, the full path must be provided.
SourceClip = "3D Movie HSBS.mkv"
# Source format is SBS?.  Can be true for SBS or false for T&B
SourceSBS = true
# source is half-TAB ?  Can be true for Half-T&B or false for full T&B.  (This setting is ignored if the source is full-SBS or half-SBS)
SourceFull = false
# Source has left view first ?  Can be true for left view first (usual), or false for right view first.
SourceLeftViewFirst = true
# Source vertical resolution.  Can be 720 or 1080
SourceResolution = 1080
# Output vertical resolution.  Can be 720 or 1080
OutputResolution = 720


# Load the source clip in Half or Full-SBS 1080p format
FFMpegSource2(SourceClip)

# Crop left and right images from Half or Full SBS source
view1 = SourceSBS ? Crop(0,  0, last.width / -2, 0) : Crop(0,  0, 0, last.height / -2)
view2 = SourceSBS ? Crop(last.width / 2, 0, 0, 0) : Crop(0, last.height / 2, 0, 0)

# Build Frame sequential clip
fs = SourceLeftViewFirst ? Interleave(view1, view2) : Interleave(view2, view1)

# If the horizontal black borders have been cropped, restore them
border = ( SourceSBS || SourceFull) ? (SourceResolution - fs.height) / 2 : (SourceResolution / 2 - fs.height) / 2
fs = ( border > 0 ) ? AddBorders(fs, 0, border, 0, border) : fs

# Resize FS clip to 720p or 1080p
LanczosResize(fs, OutputResolution * 16 / 9, OutputResolution)
You can download the script here.

Usage:

You need: Avisynth with the FFMpegSource2 avisynth plugin properly installed, a good GUI for x264 (I suggest the Simple x264/x265 Launcher), and MkvToolnix. I suggest also to install the avisynth editor AVSp Mod, to edit and verify the avisynth clip.

Copy the script in the directory containing the SBS or T&B script you want to convert.

Open it in AVSp Mod (or in any text editor like Notepad) and edit the settings at the top of the file. They should be self-explanatory. You must specify the file name of the clip, and the format, such as Half SBS Left view first 1080p (the most frequent situation). There is also an option to convert to FS full-HD (1080p) or "small-HD" (720p).

Note that the SourceResolution is the height of the source clip BEFORE any cropping of the black borders, that may have been done when the clip has been encoded to SBS or T&B. Usually, the source resolution is 1080. Note also that the SourceFull argument is used only when converting from T&B format, and is ignored for SBS.

If you have AVSp Mod, click the Play arrow in the bottom left corner of the window, and then use the Right cursor key on your keyboard or use the timeline with the mouse to start the rendering and verify that everything works as expected. (You may have to wait a long time when you play the script for the first time, because FFMpeg must generate an index file once, and that requires to scan the whole input clip.)

Now, launch your GUI for x264. Open the AVS script in the GUI. Select the x264 options you want to use, like the CRF value. DO NOT FORGET the very important --frame-packing 5 option. (Without that option, x264 will "think" that the differences between the even and odd images of the frame sequential clip are constant moves, and it may blur them !) If you use the Simple x264 Launcher, you must type that option in the "Custom encoder parameters" field.

You may want to specify other x264 options as well, such as the frame rate, the total number of frames, the level, and so on, but none are really necessary. (If you want to know the options that BD3D2MK3D uses, encode a small clip to frame-sequential, and have a look at the __ENCODE_3D.cmd file.)

Finally, launch the encoding.

When the encoding is finished, open the original SBS or T&B clip in MkvToolnix GUI, and untick the video stream. Add the new video stream you have just encoded, and specify the stereoscopy mode 13 "both eyes laced in one block (left first)". For the "Default Duration/FPS", you should use the same frame rate than in the input clip (usually 24000/1001p).

Remux. The output should be OK. Verify if there are no sync problems with the audio tracks, and if necessary, specify the correct delays in the MkvToolnix GUI and mux again.

Have fun. :-)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 18th July 2016 at 09:05.
r0lZ is offline