PeerTube icon indicating copy to clipboard operation
PeerTube copied to clipboard

Add a way to transcode videos before uploading

Open bojidar-bg opened this issue 5 months ago • 1 comments

Describe the problem to be solved

I have a small self-hosted single-user PeerTube instance running on a VPS. I want be able to push (HLS) videos out quickly after I've recorded them; however, having to wait for the VPS to transcode everything is slow. Meanwhile, my machine is much faster in comparison—and is sitting idle while I wait. Currently, the best series of step I've found for uploading a video quickly is:

  1. Change Peertube configuration to transcode only Web Videos, disable HLS videos and disable remote runners.
  2. Upload a file with an h264 video codec, yuv420p pixel format, and aac audio codec, in order to allow for quick transcode.
  3. ..Wait around for the Generate storyboard task to complete.
  4. Change Peertube configuration to enable remote runners.
  5. Go to Administration -> Overview -> Videos and request an HLS transcode.
  6. Have my machine running peertube-runner re-download the file from the server then run ffmpeg on it.

Describe the solution you would like

I want to be able to run a "magic" ffmpeg command locally, wait for it to finish, then upload the result to the server. The server should then take the result, and either use it as-is, or run a fast transcode to HLS with copyCodecs on. Ideally, I would be even able to run "Generate Storyboard" locally, to make use of the faster hardware.

Alternatively, I want to be able to enable remote runners without enabling both Web Video and HLS transcoding, when I need only HLS videos. In that case, it would be amazing if I could make the remote runner use the file available locally, to skip the redownload step, even if that involves some light hacks such as manually placing the locally-available file in the right directory. - however, a benefit of the aforementioned "magic" ffmpeg command option for me would be the ability to run the whole process offline.

Somewhat related to #5426, though I want it for VODs and not for live videos.

bojidar-bg avatar Jul 09 '25 18:07 bojidar-bg

I would be interested as well especially in conjunction with #7013 (being able to use your graphics card locally) and #6852 (do that for bulk video upload).

I see 2 things to be done.

  1. can you add a way to peertube, that if it gets files in the correct file formats it won't reencode and just use as is?
  2. can you provide us with the command or maybe even the encoding it is expecting so we can help out with the correct command line? (I for myself like the HLS feature, but I'm fine if I have to upload both versions, maybe even with the editvideo API hook)

Sythelux avatar Jul 18 '25 22:07 Sythelux