bruor 43 Posted December 28, 2023 Posted December 28, 2023 I'm looking for a way to add more transcoding power to my server so that I can transcode more than 6x 1080p60 live tv streams at once which seems to be the max my i5-9500t CPU can support. I came across https://github.com/joshuaboniface/rffmpeg which seems interesting. I have 2 servers set up side by side for failover purposes, in theory I should be able to configure rffmpeg to call emby's ffmpeg binary via the config, and then reconfigure emby to use rffmpeg which would be able to reach out to the standby server to assist with transcoding tasks. I'll be attempting to implement this on Ubuntu LTS and I'll keep this thread updated with my findings. I appreciate any feedback/assistance that anyone can offer. 1
bruor 43 Posted February 13, 2024 Author Posted February 13, 2024 I ended up trying the go version ffmpeg-of but hit a dead end. I was hoping Luke might have some insight to share on how that script should be used, I have yet to re-test on 4.8.
Luke 42079 Posted February 13, 2024 Posted February 13, 2024 I've never heard of it, but if it's a different ffmpeg build then I don't see things working out well.
Thuzad 50 Posted February 13, 2024 Posted February 13, 2024 (edited) Personally, I'd managed to completely set up rffmpeg with Emby. I was using ffmpeg binaries from Emby and not from Jellyfin. I had a set-up that worked. It was really cool technically to do this, however it's quite difficult to maintain. I gave up and went straight to a more powerful server with hardware acceleration. This set-up doesn't really allow for fail-over. Above all, it distributes the load for transcoding. Emby always runs on the main server, and if it fails, nothing else works. (I'd prefer to keep this in mind, even though it's pretty self-explanatory when you look at the project). Edited February 13, 2024 by Thuzad
bruor 43 Posted February 13, 2024 Author Posted February 13, 2024 46 minutes ago, Luke said: I've never heard of it, but if it's a different ffmpeg build then I don't see things working out well. rffmpeg is a script that intercepts and load balances the call to ffmpeg and sends it to another PC for processing. For it to work I'd need to figure out how to call emby-ffmpeg with success before I can get the script to wrap and farm out the transcode job.
Thuzad 50 Posted February 13, 2024 Posted February 13, 2024 @bruorFollow this issue: https://github.com/joshuaboniface/rffmpeg/issues/10
bruor 43 Posted February 13, 2024 Author Posted February 13, 2024 29 minutes ago, Thuzad said: Personally, I'd managed to completely set up rffmpeg with Emby. I was using ffmpeg binaries from Emby and not from Jellyfin. I had a set-up that worked. It was really cool technically to do this, however it's quite difficult to maintain. I gave up and went straight to a more powerful server with hardware acceleration. This set-up doesn't really allow for fail-over. Above all, it distributes the load for transcoding. Emby always runs on the main server, and if it fails, nothing else works. (I'd prefer to keep this in mind, even though it's pretty self-explanatory when you look at the project). If you have any notes on how you set it up I'd be really interested in them. I haven't been able to call Emby's ffmpeg commands from the cli with any success on Ubuntu LTS. If I can figure that out I can probably get this thing working.
bruor 43 Posted February 13, 2024 Author Posted February 13, 2024 1 minute ago, Thuzad said: @bruorFollow this issue: https://github.com/joshuaboniface/rffmpeg/issues/10 I don't think when I'm seeing is related, I can't call Emby's ffmpeg locally or it errors out as described at the post I linked to.
Thuzad 50 Posted February 13, 2024 Posted February 13, 2024 (edited) You need to move in this direction, without openssh portable : https://github.com/joshuaboniface/rffmpeg/issues/10#issuecomment-848825082 Edited February 13, 2024 by Thuzad
Thuzad 50 Posted February 13, 2024 Posted February 13, 2024 (edited) root@emby:/opt/emby-server/bin # ./ffmpeg -version ./ffmpeg: error while loading shared libraries: libavdevice.so.59: cannot open shared object file: No such file or directory root@emby:/opt/emby-server/bin # ./emby-ffmpeg -version ffmpeg version 5.1-emby_2023_06_25 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC built with gcc 10.3.0 (crosstool-NG 1.25.0) configuration: --cc=x86_64-emby-linux-gnu-gcc --prefix=/home/embybuilder/Buildbot/x64/ffmpeg-x64/staging --disable-alsa --disable-doc --disable-ffplay --disable-gnutls --disable-libpulse --disable-librtmp --disable-libxcb --disable-openssl --disable-vdpau --disable-vulkan --disable-xlib --enable-chromaprint --enable-fontconfig --enable-gpl --enable-iconv --enable-libaribb24 --enable-libass --enable-libdav1d --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --enable-mbedtls --enable-pic --enable-version3 --enable-libtesseract --enable-cuda-llvm --enable-cuvid --enable-libdrm --enable-libmfx --enable-nvdec --enable-nvenc --enable-vaapi --enable-opencl --enable-cross-compile --cross-prefix=x86_64-emby-linux-gnu- --arch=x86_64 --target-os=linux --enable-shared --disable-static --pkg-config=pkg-config --pkg-config-flags=--static --extra-libs='-lm -lstdc++ -lsharpyuv -pthread' --disable-debug libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 EXIT root@emby:/opt/emby-server/bin # cat emby-ffmpeg #!/bin/sh APP_DIR=/opt/emby-server export AMDGPU_IDS=$APP_DIR/share/libdrm/amdgpu.ids export FONTCONFIG_PATH=$APP_DIR/etc/fonts export LD_LIBRARY_PATH=$APP_DIR/lib:$APP_DIR/extra/lib export LIBVA_DRIVERS_PATH=$APP_DIR/extra/lib/dri export OCL_ICD_VENDORS=$APP_DIR/extra/etc/OpenCL/vendors export PCI_IDS_PATH=$APP_DIR/share/hwdata/pci.ids export SSL_CERT_FILE=$APP_DIR/etc/ssl/certs/ca-certificates.crt exec $APP_DIR/bin/ffmpeg "$@" As you can see, if you call ffmpeg it won't work, but if you call emby-ffmpeg with the right exports, it will. But be careful, because if you're using hardware acceleration, you'll also need to take ffdetect into account. But (yes, another but) if the two servers don't have the same CPU topology, it won't work. Edit: I don't have the answer to your local error. But personally I've never managed to launch a transcoding manually. I've always tested via rffmpeg with all Emby binaries and rffmpeg setup configured. Why do you want to transcode manually? Edited February 13, 2024 by Thuzad
bruor 43 Posted February 14, 2024 Author Posted February 14, 2024 (edited) I thought of using rffmpeg initially but saw the issues you linked to and decided to go with ffmpegof instead which is the go port of that project since I didn't want to mess with the workarounds required. But I see you've mentioned to attempt this without openssh portable now. Has the core issue been resolved so that this isn't required? One other reason I went with the go port was that I could centralize the database and I thought it would be nice if I could set up a cluster of servers that would load balance transcoding. I don't want to transcode manually. When I changed Emby to start calling the ffmpeg-of script instead of ffmpeg directly it would fail to play back when transcode was necessary. I was able to verify that ffmpegof is reaching out over SSH as required and can run commands against the remote server. In an effort to narrow down where the errors were stemming from I attempted to test calling emby-ffmpeg directly on a server that had no modifications in case there were some permission issues with the NFS mounts etc, and found that I get the same errors I was seeing in the logs when ffmpegof was attempting to call emby-ffmpeg. I attempted your steps of creating a file to launch a shell with environment variables intact and it didn't change what I'm seeing. At the moment I have SSH disabled so ffmpegof is falling back to localhost. The transcode and playback fails: /opt/ffmpeg-of/ffmpeg -loglevel +timing -y -print_graphs_file "/mnt/wflx2/emby/logs/ffmpeg-transcode-607104cd-542b-4bef-86d0-5fcc2d4c2dfe_1graph.txt" -copyts -start_at_zero -i "https://tvnow.best/api/stream/username/password/movie/tt19406606" -vn -an -sn -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/9DF6C3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts" [90mFeb 13 19:26:36[0m [32mINF[0m database in use: PostgreSQL 14.10 (Ubuntu 14.10-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit [90mFeb 13 19:26:36[0m [32mINF[0m starting ffmpegof [36margs=[0m"-loglevel +timing -y -print_graphs_file /mnt/wflx2/emby/logs/ffmpeg-transcode-607104cd-542b-4bef-86d0-5fcc2d4c2dfe_1graph.txt -copyts -start_at_zero -i https://tvnow.best/api/stream/username/password/movie/tt19406606 -vn -an -sn -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3.m3u8 -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/9DF6C3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts" [36mas=[0m/opt/ffmpeg-of/ffmpeg [90mFeb 13 19:26:36[0m [33mDBG[0m trying [36mhost=[0mwflx2 [90mFeb 13 19:26:36[0m [33mDBG[0m running ssh test Pseudo-terminal will not be allocated because stdin is not a terminal. This account is currently not available. [90mFeb 13 19:26:36[0m [31mWRN[0m marking as bad [36merror=[0m[31m"exit status 1"[0m [36mcommand=[0m"/usr/bin/ssh -t -o ConnectTimeout=1 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPath=/run/shm/ssh-%%r@%%h:%%p -o ControlPersist=300 -i /var/lib/emby/.ssh/id_rsa emby@172.31.0.102 /opt/emby-server/bin/ffmpeg -version" [36mhost=[0mwflx2 [90mFeb 13 19:26:36[0m [33mDBG[0m trying [36mhost=[0memby0 [90mFeb 13 19:26:36[0m [33mDBG[0m running ssh test Pseudo-terminal will not be allocated because stdin is not a terminal. This account is currently not available. [90mFeb 13 19:26:36[0m [31mWRN[0m marking as bad [36merror=[0m[31m"exit status 1"[0m [36mcommand=[0m"/usr/bin/ssh -t -o ConnectTimeout=1 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPath=/run/shm/ssh-%%r@%%h:%%p -o ControlPersist=300 -i /var/lib/emby/.ssh/id_rsa emby@172.31.0.49 /opt/emby-server/bin/ffmpeg -version" [36mhost=[0memby0 [90mFeb 13 19:26:36[0m [33mDBG[0m found optimal host [36mhostname=[0mlocalhost [36mid=[0m0 [36mservername=[0m"localhost (fallback)" [90mFeb 13 19:26:36[0m [32mINF[0m running command on localhost [90mFeb 13 19:26:36[0m [33mDBG[0m localhost [36mcommand=[0m"/opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file /mnt/wflx2/emby/logs/ffmpeg-transcode-607104cd-542b-4bef-86d0-5fcc2d4c2dfe_1graph.txt -copyts -start_at_zero -i https://tvnow.best/api/stream/username/password/movie/tt19406606 -vn -an -sn -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3.m3u8 -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/9DF6C3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts" 19:26:36.281 ffmpeg version 5.0.0-emby_2022_05_27-u1 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC 19:26:36.281 built with gcc 8.3.0 (crosstool-NG 1.24.0) 19:26:36.281 Execution Date: 2024-02-13 19:26:36 19:26:36.843 Input #0, matroska,webm, from 'https://tvnow.best/api/stream/username/password/movie/tt19406606': 19:26:36.843 Metadata: 19:26:36.843 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:26:36.843 COMMENT : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:26:36.843 ENCODER : Lavf60.5.100 19:26:36.843 Duration: 01:54:28.24, start: -0.005000, bitrate: 2718 kb/s 19:26:36.843 Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], Level 120, 23.98 fps, 23.98 tbr, 1k tbn, Start-Time 0.042s 19:26:36.843 Metadata: 19:26:36.843 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:26:36.843 VARIANT_BITRATE : 0 19:26:36.843 BPS : 3958663 19:26:36.843 NUMBER_OF_FRAMES: 164672 19:26:36.843 NUMBER_OF_BYTES : 3398605215 19:26:36.843 ENCODER : Lavc60.14.101 libx265 19:26:36.843 DURATION : 01:54:28.237000000 19:26:36.843 Stream #0:1: Audio: eac3, 48000 Hz, 5.1(side), fltp, 384 kb/s, Start-Time -0.005s 19:26:36.843 Metadata: 19:26:36.843 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:26:36.843 VARIANT_BITRATE : 0 19:26:36.843 BPS : 191980 19:26:36.843 NUMBER_OF_FRAMES: 321948 19:26:36.843 NUMBER_OF_BYTES : 164821013 19:26:36.843 ENCODER : Lavc60.14.101 eac3 19:26:36.843 DURATION : 01:54:28.223000000 19:26:36.843 Output #0, segment, to '/mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts': 19:26:36.843 Output file #0 does not contain any stream 19:26:36.843 [90mFeb 13 19:26:36[0m [1m[31mERR[0m[0m finished ffmpegof with error [36merror=[0m[31m"exit status 1"[0m If I don't use ffmpegof: /opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/mnt/wflx2/emby/logs/ffmpeg-transcode-6a90f292-fc60-4220-a829-0787a4f6ae37_1graph.txt" -copyts -start_at_zero -init_hw_device "qsv=vad:hw_any,child_device=/dev/dri/renderD128" -filter_hw_device vad -f matroska,webm -c:v:0 hevc_qsv -hwaccel:v:0 qsv -i "https://tvnow.best/api/stream/username/password/movie/tt19406606" -filter_complex "[0:0]vpp_qsv@f1=format=nv12[f1_out0]" -map [f1_out0] -map 0:1 -sn -c:v:0 h264_qsv -b:v:0 5436644 -g:v:0 72 -maxrate:v:0 5436644 -bufsize:v:0 10873288 -level:v:0 40 -keyint_min:v:0 72 -r:v:0 23.976024627685547 -profile:v:0 high -aud:v:0 1 -c:a:0 aac -ab:a:0 192000 -ac:a:0 2 -filter:a:0 "volume=2" -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973_%d.ts" 19:33:14.360 ffmpeg version 5.0.0-emby_2022_05_27-u1 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC 19:33:14.360 built with gcc 8.3.0 (crosstool-NG 1.24.0) 19:33:14.360 Execution Date: 2024-02-13 19:33:14 19:33:14.906 WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". 19:33:14.907 Input #0, matroska,webm, from 'https://tvnow.best/api/stream/username/password/movie/tt19406606': 19:33:14.907 Metadata: 19:33:14.907 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:33:14.907 COMMENT : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:33:14.907 ENCODER : Lavf60.5.100 19:33:14.907 Duration: 01:54:28.24, start: -0.005000, bitrate: 2718 kb/s 19:33:14.908 Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], Level 120, 23.98 fps, 23.98 tbr, 1k tbn, Start-Time 0.042s 19:33:14.908 Metadata: 19:33:14.908 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:33:14.908 VARIANT_BITRATE : 0 19:33:14.908 BPS : 3958663 19:33:14.908 NUMBER_OF_FRAMES: 164672 19:33:14.908 NUMBER_OF_BYTES : 3398605215 19:33:14.908 ENCODER : Lavc60.14.101 libx265 19:33:14.908 DURATION : 01:54:28.237000000 19:33:14.908 Stream #0:1: Audio: eac3, 48000 Hz, 5.1(side), fltp, 384 kb/s, Start-Time -0.005s 19:33:14.908 Metadata: 19:33:14.908 title : GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265 19:33:14.908 VARIANT_BITRATE : 0 19:33:14.908 BPS : 191980 19:33:14.908 NUMBER_OF_FRAMES: 321948 19:33:14.908 NUMBER_OF_BYTES : 164821013 19:33:14.908 ENCODER : Lavc60.14.101 eac3 19:33:14.908 DURATION : 01:54:28.223000000 19:33:14.922 Stream mapping: 19:33:14.922 Stream #0:0 (hevc_qsv) -> vpp_qsv:default (graph 0) 19:33:14.922 vpp_qsv:default (graph 0) -> Stream #0:0 (h264_qsv) 19:33:14.922 Stream #0:1 -> #0:1 (eac3 (native) -> aac (native)) 19:33:14.922 Press [q] to stop, [?] for help 19:33:15.050 Output #0, segment, to '/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973_%d.ts': 19:33:15.051 Metadata: 19:33:15.051 encoder : Lavf59.17.100 19:33:15.051 Stream #0:0: Video: h264, qsv(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5436 kb/s, Level 40, 23.98 fps, 90k tbn 19:33:15.051 Metadata: 19:33:15.051 encoder : Lavc59.21.100 h264_qsv 19:33:15.051 Side data: 19:33:15.051 cpb: bitrate max/min/avg: 5436644/0/5436644 buffer size: 10873288 vbv_delay: N/A 19:33:15.051 Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 192 kb/s (default) 19:33:15.052 Metadata: 19:33:15.052 encoder : Lavc59.21.100 aac 19:33:15.052 elapsed=00:00:00.06 frame= 1 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A throttle=off speed= 0x 19:33:15.502 elapsed=00:00:00.57 frame= 41 fps=0.0 q=15.0 size=N/A time=00:00:01.70 bitrate=N/A throttle=off speed=2.96x 19:33:15.980 [segment @ 0x13e1e40] Opening '/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973.m3u8.tmp' for writing 19:33:15.982 SegmentComplete=video:0 Index=0 Start=0.000000 End=3.044711 Duration=3.044711 offset_pts=0 start_pts=0 Frames=72 filename=C9B973_0.ts 19:33:15.982 [segment @ 0x13e1e40] Opening '/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973_1.ts.tmp' for writing 19:33:16.005 elapsed=00:00:01.08 frame= 82 fps= 76 q=15.0 size=N/A time=00:00:03.39 bitrate=N/A throttle=off speed=3.14x I just dove into the logs on 2 playback attempts for the same video using ffmpegof and without. There are some differences between the commands that are being called. Not sure why they differ a bit, in both cases the local ffdetect is being used. Emby with ffmpegof: /opt/ffmpeg-of/ffmpeg -loglevel +timing -y -print_graphs_file "/mnt/wflx2/emby/logs/ffmpeg-transcode-607104cd-542b-4bef-86d0-5fcc2d4c2dfe_1graph.txt" -copyts -start_at_zero -i "https://tvnow.best/api/stream/username/password/movie/tt19406606" -vn -an -sn -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/9DF6C3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts" calls to emby ffmpeg: /opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file /mnt/wflx2/emby/logs/ffmpeg-transcode-607104cd-542b-4bef-86d0-5fcc2d4c2dfe_1graph.txt -copyts -start_at_zero -i https://tvnow.best/api/stream/username/password/movie/tt19406606 -vn -an -sn -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3.m3u8 -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/9DF6C3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 /mnt/wflx2/emby/transcoding-temp/9DF6C3/9DF6C3_%d.ts Emby without ffmpegof: /opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/mnt/wflx2/emby/logs/ffmpeg-transcode-6a90f292-fc60-4220-a829-0787a4f6ae37_1graph.txt" -copyts -start_at_zero -init_hw_device "qsv=vad:hw_any,child_device=/dev/dri/renderD128" -filter_hw_device vad -f matroska,webm -c:v:0 hevc_qsv -hwaccel:v:0 qsv -i "https://tvnow.best/api/stream/username/password/movie/tt19406606" -filter_complex "[0:0]vpp_qsv@f1=format=nv12[f1_out0]" -map [f1_out0] -map 0:1 -sn -c:v:0 h264_qsv -b:v:0 5436644 -g:v:0 72 -maxrate:v:0 5436644 -bufsize:v:0 10873288 -level:v:0 40 -keyint_min:v:0 72 -r:v:0 23.976024627685547 -profile:v:0 high -aud:v:0 1 -c:a:0 aac -ab:a:0 192000 -ac:a:0 2 -filter:a:0 "volume=2" -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/mnt/wflx2/emby/transcoding-temp/C9B973/C9B973_%d.ts" After trying to run them all manually and seeing that they all fail, it seems like you can't manually run the same command that emby-server tries to execute, it must do some special handling to pre-stage the folder paths for ffmpeg. One thing I did notice though, is that the failure might have to do with .strm media files. I will have to re-test this with local media to see if it makes a difference. When ffmpegof is not used, the server shows the following information about the source media file: {"Protocol":"Http","Id":"5140e2f110b552999d553af884824c1b","Path":"https://tvnow.best/api/stream/username/password/movie/tt19406606","Type":"Default","Container":"mkv","Size":2333760437,"Name":"The Shift (2023)","IsRemote":true,"RunTimeTicks":68682370000,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"hevc","ColorTransfer":"bt709","ColorPrimaries":"bt709","ColorSpace":"bt709","TimeBase":"1/1000","Title":"GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265","VideoRange":"SDR","DisplayTitle":"1080p HEVC","IsInterlaced":false,"BitRate":2718322,"BitDepth":10,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":1080,"Width":1920,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main 10","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p10le","Level":120,"IsAnamorphic":false,"AttachmentSize":0},{"Codec":"eac3","TimeBase":"1/1000","Title":"GalaxyRG265 - The.Shift.2023.1080p.WEBRip.DDP5.1.x265.10bit-GalaxyRG265","DisplayTitle":"Und EAC3 5.1","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":384000,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","AttachmentSize":0}],"Formats":[],"Bitrate":2718322,"RequiredHttpHeaders":{},"ReadAtNativeFramerate":false} But when Emby calls ffmpegof, this is what is shows: {"Protocol":"Http","Id":"5140e2f110b552999d553af884824c1b","Path":"https://tvnow.best/api/stream/username/password/movie/tt19406606","Type":"Default","Container":"strm","Size":0,"Name":"The Shift (2023)","IsRemote":true,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[],"Formats":[],"RequiredHttpHeaders":{},"ReadAtNativeFramerate":false} Edited February 14, 2024 by bruor
bruor 43 Posted February 14, 2024 Author Posted February 14, 2024 I may have had some success getting it to invoke with local fallback. I believe the issue was that I was calling /opt/emby-server/bin/ffmpeg from ffmpegof instead of /opt/emby-server/bin/emby-ffmpeg. I'll re-run a test with a remote transcode and report back. 1
bruor 43 Posted February 14, 2024 Author Posted February 14, 2024 (edited) I was able to get a successful playback to work with a transcode on the remote system, but it always seems to fail when it attempts a hardware transcode and reverts to software. 23:50:11.077 ffmpeg version 5.1-emby_2023_06_25 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC 23:50:11.077 built with gcc 10.3.0 (crosstool-NG 1.25.0) 23:50:11.077 Execution Date: 2024-02-13 23:50:11 23:50:14.497 Input #0, matroska,webm, from 'https://tvnow.best/api/stream/username/password/tvshow/tt1480684/1/1': 23:50:14.497 Metadata: 23:50:14.497 encoder : libebml v0.7.8 + libmatroska v0.8.1 23:50:14.497 creation_time : 2009-10-30T04:17:47.000000Z 23:50:14.497 Duration: 00:26:43.73, start: 0.000000, bitrate: 3899 kb/s 23:50:14.497 Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, Level 31, 23.98 fps, 23.98 tbr, 1k tbn (default) 23:50:14.498 Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) 23:50:14.499 Stream mapping: 23:50:14.499 Stream #0:0 (h264_qsv) -> vpp_qsv:default (graph 0) 23:50:14.499 vpp_qsv:default (graph 0) -> Stream #0:0 (h264_qsv) 23:50:14.499 Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame)) 23:50:14.499 Press [q] to stop, [?] for help 23:50:15.048 [h264_qsv @ 0x14afa40] Selected ratecontrol mode is unsupported 23:50:15.048 [h264_qsv @ 0x14afa40] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters. 23:50:15.048 Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height 23:50:15.069 [libmp3lame @ 0x1505340] 3 frames left in the queue on closing 23:50:15.070 Conversion failed! 23:50:15.070 EXIT I think this is because the box I'm trying to test with has a slightly different chipset than the one I'm starting playback against. I will test with one that is an exact match tomorrow and report back. Edited February 14, 2024 by bruor
RanmaCanada 495 Posted February 14, 2024 Posted February 14, 2024 You would probably be better served to just install an ARC card. 1
bruor 43 Posted February 14, 2024 Author Posted February 14, 2024 Not sure it would increase the transcoding capabilities drastically compared to the 11th gen i5 QSV engine. Right now I can transcode 6 1080p60 streams at once, would an ARC gpu be able to handle more than that? Also, these boxes are low power elite desk 800 g5 mini PCs, there's no room for a card in them but if ARC can get me 4x or 5x the transcoding capabilities then I'd consider changing my hardware.
Neminem 1519 Posted February 14, 2024 Posted February 14, 2024 ok so 6 x 1080p60 streams is borking down you system Why are there clients not able to direct play that ?
bruor 43 Posted February 14, 2024 Author Posted February 14, 2024 Bandwidth issues with poor wifi on the client side. At my in-laws place I installed an Aruba AP and put their Chromecast on an HDMI extension to get a more direct line of sight but something in that house hates wifi, I can't get stable playback at anything above 3mbps so the 20mbps 1080p60 streams from the provider have to be compressed. This seems to affect about half of my friends and family. Some can direct stream just fine though ¯\_(ツ)_/¯
bruor 43 Posted February 19, 2024 Author Posted February 19, 2024 Just reporting back with success on this end. This is the package I used https://github.com/tminaorg/ffmpegof After making sure that hardware is identical between the source and target servers sending the transcode job to a remote host works without issue. 1 1
podonnell 47 Posted August 7, 2024 Posted August 7, 2024 (edited) Any one who has used this able to comment on MKV to MP4 on-the-fly transcoding? I'm trying to solve for Emby's lack of remux capabilities to be able to see Dolby Vision content on my LG. I was led to this software and was hoping it might be able to be called when I play any MKV videos. I also just have the very basic question of - where/how can we call custom ffmpeg scripts when playing a video? Is that actually possible with Emby? Edited August 7, 2024 by podonnell
visproduction 315 Posted August 11, 2024 Posted August 11, 2024 On 8/6/2024 at 7:42 PM, podonnell said: Any one who has used this able to comment on MKV to MP4 on-the-fly transcoding? PD, have a look here... https://www.reddit.com/r/ffmpeg/comments/qe7oq1/dolby_vision_from_mkv_to_mp4_using_ffmpeg_and/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now