How to increase video transcoding speed?

In my opinion, the transcoding speed is too low, for the provided resources.

My PeerTube instance (version: 5.2.1) has 8GB RAM, 8CPUs with barely any viewers for now.

I’m running VOD Transcoding jobs via Remote Runners (to increase performance).
I’ve provided 10 (concurrent) runners on a 64GB RAM, 32CPU machine.

There’s a gigabit connection between the 2 instances.

The transcoding is still too slow!

My settings:


Example, (sanitised) logs of a job from my instance:

-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
> 93a91565-feb5-40ec-8d06-c592e7e977b9	vod-web-video-transcoding	Completed	100			12/28/23, 12:48:51.407 PM

Parent job: -
Processed on 12/28/23, 2:55:25.614 PM
Finished on 12/28/23, 3:08:37.359 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/93a91565-feb5-40ec-8d06-c592e7e977b9/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 1080
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true
}
-----------------------------------------------------------------------------------------
> e44378c3-6773-4ef8-ab37-ac1953a9bba1	vod-hls-transcoding	Completed	100			12/28/23, 12:48:51.468 PM

Parent job: 93a91565-feb5-40ec-8d06-c592e7e977b9
Processed on 12/28/23, 3:14:00.069 PM
Finished on 12/28/23, 3:22:18.576 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/e44378c3-6773-4ef8-ab37-ac1953a9bba1/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 720
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true,
  "deleteWebVideoFiles": false
}
-----------------------------------------------------------------------------------------
> c7e26893-8b5e-48db-8f9e-a0e514748a60	vod-web-video-transcoding	Completed	100			12/28/23, 12:48:51.458 PM

Parent job: 93a91565-feb5-40ec-8d06-c592e7e977b9
Processed on 12/28/23, 3:13:52.905 PM
Finished on 12/28/23, 3:22:03.179 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/c7e26893-8b5e-48db-8f9e-a0e514748a60/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 720
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true
}
-----------------------------------------------------------------------------------------
> 75f84c27-aad1-4ce6-b0d6-0bcebfc00886	vod-hls-transcoding	Completed	100			12/28/23, 12:48:51.447 PM

Parent job: 93a91565-feb5-40ec-8d06-c592e7e977b9
Processed on 12/28/23, 3:13:31.589 PM
Finished on 12/28/23, 3:19:36.317 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/75f84c27-aad1-4ce6-b0d6-0bcebfc00886/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 480
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true,
  "deleteWebVideoFiles": false
}
-----------------------------------------------------------------------------------------
> 0c6cd1d7-727e-43a9-b991-913b276491fc	vod-web-video-transcoding	Completed	100			12/28/23, 12:48:51.436 PM

Parent job: 93a91565-feb5-40ec-8d06-c592e7e977b9
Processed on 12/28/23, 3:12:03.211 PM
Finished on 12/28/23, 3:18:08.778 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/0c6cd1d7-727e-43a9-b991-913b276491fc/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 480
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true
}
-----------------------------------------------------------------------------------------
> b986a9b4-6f6b-4362-8244-1ba1713ae591	vod-hls-transcoding	Completed	100			12/28/23, 12:48:51.423 PM

Parent job: 93a91565-feb5-40ec-8d06-c592e7e977b9
Processed on 12/28/23, 3:08:37.856 PM
Finished on 12/28/23, 3:20:25.380 PM
Payload:
{
  "input": {
    "videoFileUrl": "https://my-domain/api/v1/runners/jobs/b986a9b4-6f6b-4362-8244-1ba1713ae591/files/videos/<video-uuid>/max-quality"
  },
  "output": {
    "fps": 30,
    "resolution": 1080
  }
}
Private payload:
{
  "videoUUID": "<video-uuid>",
  "isNewVideo": true,
  "deleteWebVideoFiles": false
}
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------

This job took more than 30 mins.!

Is this expected?

Is there any way that i can speed this up significantly?


1 « J'aime »

Any feedback on this, anyone?

Hi,

Check the runner config to increase ffmpeg threads

I’m already running 10 runners/threads in parallel!

Are there any benchmarks for performance (time taken) vs resources, which i can use as a reference, to compare with my scenario?

I’m already running 10 runners/threads in parallel!

I’m not sure to understand. You don’t need to run multiple runners in parallel. Juste update ~config/peertube-runner-nodejs/common/config.toml of 1 runner and update concurrency to 10. If you want faster transcoding you can also set a different value for threads under [ffmpeg] section.

I seem to have expressed this improperly.

My current config is-

[jobs]
concurrency = 5

[ffmpeg]
threads = 2
nice = 20

Then increase threads value to have faster transcoding jobs

Will try that.

Also, where do i find reference information, to understand the relation of concurrency & threads values with performance?

@Chocobozzz

With this config:
2 servers (8 CPUs), each with -

[jobs]
concurrency = 4

[ffmpeg]
threads = 8
nice = 20

it took a total of 10 videos-

  • 5 mins. to get imported
  • 4 hours to get transcoded (HLS only: 1080p, 720p, 480p)

This seems to me really slow!

Kindly correct me if my perception is inappropriate.

If not, what could be the issue here? And how to remedy it?

Try with concurrency = 1 as ffmpeg should already use all you CPUs with thread = 8. Then ensure on your server using top that ffmpeg consumes all available CPU.

How long are your videos? (« 4 hours » does not give any information, if we don’t know how long videos are).

What cpu are you using? What video codec are you using? What quality are you transcoding to?