Jump to content

Multiple transcoding attempt failed


Recommended Posts

Posted

Good morning,

The Emby server is encountering issues with hardware transcoding, causing it to fall back to software transcoding. This behavior can result in increased CPU usage and potential performance degradation, especially during multiple simultaneous streams.

Error message:

Info Previous transcoding attempt failed. Falling back to software transcoding.

The video that transcodes comes from another transcoding (Inserted as IPTV) that I do previously with the following code:

"ffmpeg -fflags +genpts+discardcorrupt -re -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -i \"$SELECTED_URL\" -c:v h264_nvenc -preset p2 -tune ll -profile:v main -cq 20 -rc-lookahead 28 -c:a aac -b:a 192k -ac 6 -vsync cfr -async 1 -max_muxing_queue_size 1024 -f hls -hls_time 2 -hls_list_size 10 -hls_flags delete_segments+independent_segments -hls_segment_type mpegts -hls_segment_filename \"/var/www/hls/stream_%03d.ts\" \"/var/www/hls/stream.m3u8\"

It is a problem for me as it overloads my CPU, what I would be interested in is to make a first transcoding so that later the clients do not have to convert video/audio as they are broadcasts in which I can have 5-6 users, and the CPU is old and does not support it.

My server:

NAME="Linux Mint"
VERSION="21.3 (Virginia)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21.3"
VERSION_ID="21.3"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=virginia
UBUNTU_CODENAME=jammy

I attached the full log.

Many thanks.

 

ffmpeg-transcode-7b4cceb3-6d5e-41b9-8472-b8e43f27148a_1.txt

Posted

Hi, did you see this?

21:58:48.725 Execution Date: 2025-02-11 21:58:48
21:58:48.813 [http @ 0x1574b000] HTTP error 404 Not Found
21:58:48.814 http://192.168.1.12:9000/hls/stream2.m3u8: Server returned 404 Not Found

 

Posted (edited)

I am sorry for the delay.

Yes I see that error but is not relevant in that problem, I attached you other logs where show error in DirectPlay and transcode again.

2025-02-17 14:21:18.729
Operating System: Linux version 5.15.0-131-generic (buildd@lcy02-amd64-057) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #141-Ubun
OS/Process: x64/x64
Emby Server version: 4.8.10.0
Operating system: Unix 5.15.0.131
Command Line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb

App: Emby for Android 3.4.36
NX725J
User-Agent: Emby/3.4.36 (Linux;Android 14) AndroidXMedia3/1.5.1

http://79.116.30.141:8096/emby/videos/1055244/live.m3u8?DeviceId=662ce80e137d9f47&MediaSourceId=9a32de4e103a4449bf26a3d08ff1d8cc&PlaySessionId=deb5b65bbd9949a6acb5ef14a637771d&api_key=x_secret1_x&VideoCodec=h264,mpeg2video,hevc&AudioCodec=ac3,aac,mp3,mp2&VideoBitrate=4390300&AudioBitrate=320000&AudioStreamIndex=1&TranscodingMaxAudioChannels=6&SegmentContainer=ts&SegmentLength=3&MinSegments=1&BreakOnNonKeyFrames=True&SubtitleStreamIndexes=-1&ManifestSubtitles=vtt&hevc-profile=Main,Main10,Rext&h264-level=51&TranscodeReasons=DirectPlayError&allowVideoStreamCopy=false

{"Protocol":"Http","Id":"9a32de4e103a4449bf26a3d08ff1d8cc","Path":"http://192.168.1.12:9000/hls/stream.m3u8","Type":"Default","Container":"hls","Size":425,"Name":"IPTV 1","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"h264","TimeBase":"1/90000","VideoRange":"SDR","DisplayTitle":"720p H264","NalLengthSize":"0","IsInterlaced":false,"BitDepth":8,"RefFrames":1,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":720,"Width":1280,"AverageFrameRate":50,"RealFrameRate":50,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p","Level":32,"IsAnamorphic":false,"ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0},{"Codec":"aac","TimeBase":"1/90000","DisplayTitle":"AAC 5.1","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":320000,"Channels":6,"SampleRate":44100,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Profile":"LC","Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0}],"Formats":[],"Bitrate":320000,"RequiredHttpHeaders":{},"AddApiKeyToDirectStreamUrl":false,"ReadAtNativeFramerate":false,"ItemId":"1055244"}

>>>>>>  User policy for *********
        Enable Playback Remuxing: True
        Enable Video Playback Transcoding: True
        Enable Audio Playback Transcoding: True

>>>>>>  Hardware Decoders for h264
        [X] NVDEC NVIDIA GeForce GTX 970 - H.264 (AVC)

>>>>>>  Hardware Encoders for h264
        [X] NVENC NVIDIA GeForce GTX 970 - H.264 (AVC)

>>>>>>  Selected Codecs
Decoder NVDEC NVIDIA GeForce GTX 970 - H.264 (AVC)
        Adapter #0: 'NVIDIA GeForce GTX 970' ComputeCapability: 5.2
        Max Bitrate: 234 Mbit/s - Frame Sizes: 48x16...4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Color Formats: NV12 - Bit Depths: 8
        Profiles: Constrained Baseline Profile (Level 6), Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6), Constrained High Profile (Level 6), Progressive High Profile (Level 6)

Encoder NVENC NVIDIA GeForce GTX 970 - H.264 (AVC)
        Adapter #0: 'NVIDIA GeForce GTX 970' ComputeCapability: 5.2
        Max Bitrate: 781 Mbit/s - Frame Sizes: max 4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Color Formats: NV12, P010, P016 - Bit Depths: 8, 10, 12, 14, 16
        Profiles: Baseline Profile (Level 6.2), Main Profile (Level 6.2), High Profile (Level 6.2), High 4:4:4 Predictive Profile (Level 6.2)

 

In order to make it as compatible as possible with DirectStream, what would you modify? I made several changes to buffering, fps etc but I'm still stumbling around....

I saw that emby applies the following FFMPEG command:

/opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/var/lib/emby/logs/ffmpeg-transcode-adc8044f-abe1-4ead-91a7-97cec22127fa_1graph.txt" -copyts -start_at_zero -init_hw_device "cuda=cuda:0" -f hls -c:v:0 h264 -threads:v:0 1 -hwaccel:v:0 cuda -hwaccel_output_format:v:0 cuda -noautorotate -i "http://192.168.1.12:9000/hls/stream.m3u8" -map 0:0 -map 0:1 -sn -c:v:0 h264_nvenc -b:v:0 4390300 -g:v:0 150 -maxrate:v:0 4390300 -bufsize:v:0 8780600 -keyint_min:v:0 150 -r:v:0 50 -profile:v:0 main -c:a:0 copy -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/media/NFS/16TB/emby_cache/transcoding-temp/B54AF3/B54AF3.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/B54AF3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/media/NFS/16TB/emby_cache/transcoding-temp/B54AF3/B54AF3_%d.ts"

Many thanks.

ffmpeg-transcode-20c0fad8-6369-451c-a484-bdd8b4ccbbbf_1.txt

Edited by Tormund
Posted

Why would you say that isn't relevant? That is your stream URL sending back a 404 not found response.

Posted
On 2/18/2025 at 2:43 AM, Tormund said:

I am sorry for the delay.

Yes I see that error but is not relevant in that problem, I attached you other logs where show error in DirectPlay and transcode again.

2025-02-17 14:21:18.729
Operating System: Linux version 5.15.0-131-generic (buildd@lcy02-amd64-057) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #141-Ubun
OS/Process: x64/x64
Emby Server version: 4.8.10.0
Operating system: Unix 5.15.0.131
Command Line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb

App: Emby for Android 3.4.36
NX725J
User-Agent: Emby/3.4.36 (Linux;Android 14) AndroidXMedia3/1.5.1

http://79.116.30.141:8096/emby/videos/1055244/live.m3u8?DeviceId=662ce80e137d9f47&MediaSourceId=9a32de4e103a4449bf26a3d08ff1d8cc&PlaySessionId=deb5b65bbd9949a6acb5ef14a637771d&api_key=x_secret1_x&VideoCodec=h264,mpeg2video,hevc&AudioCodec=ac3,aac,mp3,mp2&VideoBitrate=4390300&AudioBitrate=320000&AudioStreamIndex=1&TranscodingMaxAudioChannels=6&SegmentContainer=ts&SegmentLength=3&MinSegments=1&BreakOnNonKeyFrames=True&SubtitleStreamIndexes=-1&ManifestSubtitles=vtt&hevc-profile=Main,Main10,Rext&h264-level=51&TranscodeReasons=DirectPlayError&allowVideoStreamCopy=false

{"Protocol":"Http","Id":"9a32de4e103a4449bf26a3d08ff1d8cc","Path":"http://192.168.1.12:9000/hls/stream.m3u8","Type":"Default","Container":"hls","Size":425,"Name":"IPTV 1","IsRemote":true,"HasMixedProtocols":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"h264","TimeBase":"1/90000","VideoRange":"SDR","DisplayTitle":"720p H264","NalLengthSize":"0","IsInterlaced":false,"BitDepth":8,"RefFrames":1,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":720,"Width":1280,"AverageFrameRate":50,"RealFrameRate":50,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p","Level":32,"IsAnamorphic":false,"ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0},{"Codec":"aac","TimeBase":"1/90000","DisplayTitle":"AAC 5.1","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":320000,"Channels":6,"SampleRate":44100,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Profile":"LC","Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0}],"Formats":[],"Bitrate":320000,"RequiredHttpHeaders":{},"AddApiKeyToDirectStreamUrl":false,"ReadAtNativeFramerate":false,"ItemId":"1055244"}

>>>>>>  User policy for *********
        Enable Playback Remuxing: True
        Enable Video Playback Transcoding: True
        Enable Audio Playback Transcoding: True

>>>>>>  Hardware Decoders for h264
        [X] NVDEC NVIDIA GeForce GTX 970 - H.264 (AVC)

>>>>>>  Hardware Encoders for h264
        [X] NVENC NVIDIA GeForce GTX 970 - H.264 (AVC)

>>>>>>  Selected Codecs
Decoder NVDEC NVIDIA GeForce GTX 970 - H.264 (AVC)
        Adapter #0: 'NVIDIA GeForce GTX 970' ComputeCapability: 5.2
        Max Bitrate: 234 Mbit/s - Frame Sizes: 48x16...4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Color Formats: NV12 - Bit Depths: 8
        Profiles: Constrained Baseline Profile (Level 6), Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6), Constrained High Profile (Level 6), Progressive High Profile (Level 6)

Encoder NVENC NVIDIA GeForce GTX 970 - H.264 (AVC)
        Adapter #0: 'NVIDIA GeForce GTX 970' ComputeCapability: 5.2
        Max Bitrate: 781 Mbit/s - Frame Sizes: max 4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Color Formats: NV12, P010, P016 - Bit Depths: 8, 10, 12, 14, 16
        Profiles: Baseline Profile (Level 6.2), Main Profile (Level 6.2), High Profile (Level 6.2), High 4:4:4 Predictive Profile (Level 6.2)

 

In order to make it as compatible as possible with DirectStream, what would you modify? I made several changes to buffering, fps etc but I'm still stumbling around....

I saw that emby applies the following FFMPEG command:

/opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/var/lib/emby/logs/ffmpeg-transcode-adc8044f-abe1-4ead-91a7-97cec22127fa_1graph.txt" -copyts -start_at_zero -init_hw_device "cuda=cuda:0" -f hls -c:v:0 h264 -threads:v:0 1 -hwaccel:v:0 cuda -hwaccel_output_format:v:0 cuda -noautorotate -i "http://192.168.1.12:9000/hls/stream.m3u8" -map 0:0 -map 0:1 -sn -c:v:0 h264_nvenc -b:v:0 4390300 -g:v:0 150 -maxrate:v:0 4390300 -bufsize:v:0 8780600 -keyint_min:v:0 150 -r:v:0 50 -profile:v:0 main -c:a:0 copy -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/media/NFS/16TB/emby_cache/transcoding-temp/B54AF3/B54AF3.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/B54AF3/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/media/NFS/16TB/emby_cache/transcoding-temp/B54AF3/B54AF3_%d.ts"

Many thanks.

ffmpeg-transcode-20c0fad8-6369-451c-a484-bdd8b4ccbbbf_1.txt 14.92 kB · 3 downloads

What error does this show? please attach the server and ffmpeg log together. Thanks.

Posted

OK just for testing purposes, if you turn off hardware transcoding in server transcoding settings, how do things compare after that?

Posted
Quote

The question is which ffmpeg command

You don't have to run any ffmpeg commands. You just have to get the problem to occur in Emby and then attach all log files that were written to during that time.

Posted

Of course I have to run an ffmpeg command, maybe I didn't make myself clear. What I'm doing is a re-stream of an HLS video channel, then I run an ffmpeg command to have that channel in a local url http://localhost:9000/hls/stream.m3u8.
I make it as friendly as possible with the following:

 

sudo ffmpeg -fflags +genpts+discardcorrupt -re -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -i \"$SELECTED_URL\" -c:v h264_nvenc -preset p5 -b:v 2500k -maxrate 3000k -bufsize 60000k -r 25 -g 60 -vf "scale=1280:720" -c:a aac -b:a 192k -ac 2 -vsync cfr -async 1 -max_muxing_queue_size 1024 -gpu 0 -f hls -hls_time 6 -hls_list_size 20 -hls_flags delete_segments+independent_segments -hls_segment_type mpegts -hls_segment_filename \"/var/www/hls/stream_%03d.ts\" \"/var/www/hls/stream.m3u8\"

The issue is that emby then transcodes to all clients trying to connect to the stream (not efficency for my server) . It always flags ‘bitrate rate exceeded’. If I play it from my LAN it does play in ‘Direct Playback’, but I observe very high streams (1000mbps) for the ffmpeg encoding I set (-c:v h264_nvenc -preset p5 -b:v 2500k -maxrate 3000k -bufsize 60000k -r 25 -g 60 -vf ‘scale=1280:720’ -c:aac -b:a 192k).

Posted

@Tormundwhat do you mean exactly by "very high streams" ?

  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...