Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
12.99k stars 1.49k forks source link

Transcoding existing (webtorrent) video to HLS generates black screen with audio #3414

Closed pprw closed 3 years ago

pprw commented 3 years ago

After upgrading peertube to 2.4 (from 2.1), I tried to transcode some video to HLS with the CLI command. I was previously using only webtorrent and I disable it for HLS.

After transcoding to HLS, I see the files generated on the server with reasonable size but I have a black screen with audio only when visiting peertube instance.

Here is what I have as resolutions:

image

If I uploaded again the original file from the web interface (new video id), I can see the video without issue.

$ ffmpeg -version 
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100
Chocobozzz commented 3 years ago

Hello and sorry for the late answer. Please could you retry with PeerTube v3?

pprw commented 3 years ago

Sorry for the late answer.

I just upgraded to 3.0.1.

I can confirm this bug is fixed. Old webtorrent videos are transcoded to HLS without issue.

However, attempts from 2.4 version (black screen video with audio only) could not be transcoded. Files seems to be all audio only. The files was like that before upgrading to 3.0.1.


--- /data/peertube-storage/streaming-playlists/hls/29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4 -------------------------
    5,6 MiB [##########]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-240-fragmented.mp4                                
    5,6 MiB [##########]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-0-fragmented.mp4
    5,6 MiB [##########]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-720-fragmented.mp4
    5,6 MiB [##########]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-360-fragmented.mp4
    5,6 MiB [######### ]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-480-fragmented.mp4
    5,6 MiB [######### ]  29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4-1080-fragmented.mp4
   52,0 KiB [          ]  segments-sha256.json
   12,0 KiB [          ]  1080.m3u8
   12,0 KiB [          ]  720.m3u8
   12,0 KiB [          ]  480.m3u8
   12,0 KiB [          ]  360.m3u8
   12,0 KiB [          ]  240.m3u8
   12,0 KiB [          ]  0.m3u8
    4,0 KiB [          ]  master.m3u8

So I tried to reimport the file with

sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v 29635ee2-0ae9-4cae-8a89-f1dbfa3f01e4 -i ../POSTER_PRESENTATION1.mp4

But I have this error:

info[07/02/2021 à 13:28:18] Processing video file in job 1303.

error[07/02/2021 à 13:28:18] Cannot execute job 1303 in queue video-transcoding.

{
  "payload": {
    "type": "hls",
    "copyCodecs": true
  },
  "err": {
    "stack": "Error: WHERE parameter \"uuid\" has invalid \"undefined\" value\n    at PostgresQueryGenerator.whereItemQuery (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2258:13)\n    at Utils.getComplexKeys.forEach.prop (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2247:25)\n    at Array.forEach (<anonymous>)\n    at PostgresQueryGenerator.whereItemsQuery (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2245:35)\n    at PostgresQueryGenerator.getWhereConditions (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2663:19)\n    at PostgresQueryGenerator.selectQuery (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1316:28)\n    at PostgresQueryInterface.select (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/dialects/abstract/query-interface.js:939:27)\n    at Function.findAll (/var/www/peertube/versions/peertube-v3.0.1/node_modules/sequelize/lib/model.js:1753:47)\n    at process._tickCallback (internal/process/next_tick.js:68:7)",
    "message": "WHERE parameter \"uuid\" has invalid \"undefined\" value"
  }
}

I will open a new issue if you think it is unrelated.

pprw commented 3 years ago

P-S: I notice the transcoding by CLI is always to HLS even if --generate-hls is omitted. Is it normal?

Chocobozzz commented 3 years ago

But I have this error:

This will be fixed in the next version: https://github.com/Chocobozzz/PeerTube/issues/3670

Is it normal?

Yes, by default it uses the instance config (I think you enabled HLS)