Jump to content

Adding dummy file over layer break (Blu-ray)


mattkarma

Recommended Posts

Problem :
When writing dual-layer (and triple as well, I guess) Blu-rays the layer break is always at the edge of the disc. 

This isn't Imgburn's "fault", it's just the way BD are written I guess. But the edges have worse quality in general, and it's not uncommon to have a "spike" in reading layer break.

Solution? :
Adding a quite large "dummy file" before, during and after layer break helps putting important files further away from edge of disc.  If burning 35GB I'd rather have a 10+ GB dummy file at the edge. 

I do this manually when burning important Blu-ray discs by adding a large file. Imgburn seems to burn files alphabetically and by putting, say, large dummy-file 00004b.m2ts in the STREAM-folder I get the layer break in this file while all the movies/episodes have no issue. More than once I've later had read errors on the dummy file while all others have worked fine. (I have several burners, they do work well, but media quality these days...)

I'm thinking of writing a little script to automate this on folders before I burn, but I think it would be nice if burn programs included possibility of dummy file to enhance quality/readability of important files. 

Link to comment
Share on other sites

@mattkarma: Do you think you can create a script to automate this in a folder in order to avoid the layer break issues when using BD-R DL in general? For example, let's just say that I have a large HD video file and I would like to convert it in a BDMV folder without quality loss using tsMuxeR in order to burn it later using Imgburn.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
Posted (edited)

Sorry for a very late reply, due to the very poor/varying quality of affordable DL Blu-ray I pretty much stopped using them.  But I used Google Gemini AI to write a script in Powershell, for BD movies, basically it is like this :

First a couple of notes: I don't know Powershell. This was pretty much entirely written by Gemini. I just changed the layer size a bit. The code has no error correction or anything. If the STREAM-folder is close to 50GB it won't work. It will only accept the STREAM-folder (for BD movies, script depends on all big files being in the same folder - for data discs it could be  other folder than STREAM folder obviously).  
 

param(
  # Path to the folder containing the files
  [Parameter(Mandatory=$true)]
  [string] $FolderPath
)

# Set the size limits in bytes

$maxSizeLayer = 24000000000

# Function to get the total size of files
function Get-TotalFileSize {
  param(
    [Parameter(Mandatory=$true)]
    [string[]] $FilePaths
  )

  $fileSizes = $FilePaths | ForEach-Object { Get-Item $_ -Force | Select-Object Length }
  $fileSizes | Measure-Object -Sum | Select-Object -ExpandProperty Sum
}

# Get all files in the folder sorted alphabetically
$files = Get-ChildItem -Path $FolderPath -File | Sort-Object Name

# Track the total size and last added file
$totalSize = 0
$lastFile

# Loop through files until reaching limit
foreach ($file in $files) {
  $fileSize = $file.Length
  if ($totalSize + $fileSize -lt $maxSizeLayer) {
    $totalSize += $fileSize
    $lastFile = $file
  } else {
  break
  }
}

$paddingFileSize = (25GB - $totalSize)

# Calculate padding file size
$paddingSize = $paddingFileSize
# Check if padding is needed
if ($paddingFileSize -gt 0) {
  # Create padding filename based on last added file
  $paddingFileName = ($lastFile.Name.Split('.')[-2] + "dummy") + "." + ($lastFile.Name.Split('.')[-1])
  $paddingFilePath = Join-Path $FolderPath -ChildPath $paddingFileName
  # Write message about padding file
  Write-Host "Creating padding file: $paddingFileName with size: $($paddingSize / 1KB) KB"
  fsutil file createNew $paddingFilePath $paddingSize
} else {
  Write-Host "No padding file needed. Total size reached the limit."
}


To use this script, create a text document, for example padder.ps1 , I put my on my Desktop. Then I open Powershell, , and run 

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
(My Windows is restricted from running scripts in Powershell)

 I then drag my script to the Powershell windows, run it, and drag the STREAM-folder, and will get something looking like this: 

 

PS C:\Users\MattKarma> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
PS C:\Users\MattKarma> C:\Users\MattKarma\Desktop\Padder.ps1
cmdlet Padder.ps1 at command pipeline position 1
Supply values for the following parameters:
FolderPath: C:\multiAVCHD\AVCHD\BDMV\STREAM
Creating padding file: 00006dummy.m2ts with size: 3742564 KB
File C:\multiAVCHD\AVCHD\BDMV\STREAM\00006dummy.m2ts is created
PS C:\Users\MattKarma>


Again, this is a very crude solution, and it also assumes the burning program burns files alphabetically and not based on when files were created or something else.
It also assumes that the size of .mt2ts files are reasonable
, I use something like 4000 MB m2ts media split in MultiAVCHD. If you have 3  15GB .m2ts files it won't work. 

Edited by mattkarma
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.