Adding a new resolution to an existing video / playlist

Hi there,

Spoiler : this is in facts is not a question since i found a solution, that i will of course provide.
I create this here for helping peertube instance owners facing same problem.

i faced a need to quickly add 360p video to a list of 29 video within a playlist of 1080p video.
This was triggered by the author of video because she can’t watch them correctly from her devices. When she told me she duplicated her video to youtube to overcome the issue, i sacrified my sunday afternoon to get a solution.
It took me some time to understand this was due to bandwith, our server was fine but not client access, and providing 360p just did drastically changed the user experience.
That’s told, i already did the playlist and was already provided some links to existing videos to various places. My first idea to just resubmit all videos with new config parameters set to encode with 360p and 1080p was realy not a good plan since it would change all url and ownership and require download and so on. ( this setting is in Administration / configuration / Advanced parameters )
Another constraint was that those video belong to another account than mine, and that i had to teach user how to accept new video after ownership change; i prefered to not involved my user anymore, given the huge work it was to do those videos and then to upload on peertube.

So i finaly did some test and wrote a script that parses a list of playlist video urls to reencode in 360p and add this to existing; this is just a simple use of existing scripts on peertube and call of ffmpeg with quite same parameters.

git project is here :
script is

What i learnt from writing that script is that ffmpeg requires -nostdin else it consume stdin parameters and do nasty thing with them.


and yes it is working see that wonderful playlist :

Thanks! That’s great!
Can you extend your script so it can add HLS format for videos submitted before peertube supported this format?

Another idea would be to do transcoding on an other server. I think it would be easy to modify your script to:

  • scp the original file on another server
  • run FFMEG on that server via a ssh command
  • scp the result back to the peertube server
  • “chown peertube” on the new files
  • import in peertube

I have no idea if using a different format for encoding would work at import.
but modifying this script to do transcoding on another serveur might not be very complicated, this always is a question of free time work and family life.

Your script use:
pushd /var/www/peertube/

But on my instance, I have to be in pushd /var/www/peertube/peertube-latest to launch create-import-video-file-job

1 Like

Thanks, i take note.
i run it on a yunohost peertube, what is not the default path for standard install.
i have to check it on my other instance manually installed.

Not well tested but i did commit something based on your request…

1 Like

Great! I’ll test that the next time I need to add a resolution to a video.

I referenced this discussion and your git project here:

Here I would like to use Peertube to share a video project related to a theatrical creation as part of a Marseille festival.
The project includes a series of videos (about twenty / 5go-10go) which can potentially accommodate a fairly large number of Internet users of travis hoodies. As part of the relationship with the festival organizers here, I would like to host these videos on a stable Peertube instance and if possible interested in a project of this kind. Do you have any advice from instances?

Besides, I would have liked to know if there were possibilities to get an embed code for a peertube playlist!


Do you have any advice from instances?

No sorry, I don’t know such instance. Could you install one?

Not yet, but it’s in our roadmap (step 3):