This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Parallel video encoding in Hybrid
#13
32k is just a random limit for the chunk size. (I needed to set some limit)

At the moment the amount of chunks, is determined by:
a. the length of the video
b. the number of scene changes
c. the minimal chunk size (= minimal number of frames in a chunk). This needed to avoid creating tons of chunks due to scene changes.

What Hybrid does is run a scene change detection.
Go through these scene changes and create a list of trims, which respecting 'minimal chunk size'.
For each of the resulting trims, Hybrid will later create a separate chunk to encode.

void JobGeneration::collectedSceneChanges(const QStringList& sceneChanges)
{
  int minSceneChangeSize = m_currentParameters.modelHandler()->getGlobalDataModel()->intValue(QString("minChunkSceneSize"));
  m_sceneChangeTrims.clear();
  int current = -1;
  int previous = -1;
  int count = sceneChanges.count();
  if (count == 0) {
    sendMessage(HERROR, QString("Failed detecting scene changes,.."));
    return;
  }
  count = 0;
  foreach(QString line, sceneChanges) {
    line = line.trimmed();
    if (line.isEmpty() || line.startsWith(HASH)) {
      continue;
    }
    current++;
    if (!line.startsWith(QString("i"))) {
      continue;
    }
    if (previous == -1) {
      previous = current;
      continue;
    }
    if ((current-previous) < minSceneChangeSize) {
      continue;
    }
    count++;
    m_sceneChangeTrims << QString("%1,%2").arg(previous).arg(current-1);
    previous = current;
  }
  sendMessage(HLOG, QString("Found %1 scene changes,..").arg(count));
  m_sceneChangeTrims << QString("%1,%2").arg(previous).arg(current);
  this->createJob();
}

Yes, other code to create trims could be written, but I don't plan on doing that atm. .
(no time, trying to get Hybrids build and deploy scripts working atm.)
I also don't see why using a decent chunk size and limiting the number of parallel processed sub jobs isn't enough.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply


Messages In This Thread
Parallel video encoding in Hybrid - by Dan64 - 02.10.2024, 17:54
RE: Parallel video encoding in Hybrid - by Selur - 26.10.2025, 13:53

Forum Jump:


Users browsing this thread: 1 Guest(s)