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 : https://framagit.org/artlog/piretubehack
script is peertubehack_add_resolution.sh

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

PS:

and yes it is working see that wonderful playlist : https://slvtv.fr/lstu/valbonne_paroles_d_habitants

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