Jump to content

ffmpeg segfault when transcoding TrueHD 7.1 Audio with HDR10 video


albumhaircut

Recommended Posts

albumhaircut

Emby Server 4.7.8.0 running in Docker on Unraid 6.11.1 via official Embyserver Docker image. Not sure why 4.7.8.0 is returned for :latest as there are newer version tagged (4.8.0.12 for example) but hopefully that's not important for this issue.

Issue is ffmpeg is segfaulting immediately when transcoding TrueHD 7.1 audio . Log line from syslog:

Oct 16 22:23:41 GServer kernel: ffmpeg[32298]: segfault at fffffffffffff100 ip 0000147f2aedf5b8 sp 0000147f27e04610 error 5 in libavcodec.so.59.21.100[147f2ab17000+18c6000]
Oct 16 22:23:41 GServer kernel: Code: 55 1a 48 89 08 48 83 c0 08 48 39 c2 75 f4 e9 17 f8 ff ff 0f 1f 80 00 00 00 00 48 8b 44 24 58 48 8b b4 24 48 83 e0 fe 48 29 c6 <f3> 0f 6f 0e 0f 11 8c 24 92 01 00 00 e9 e6 f7 ff ff 0f 1f 80 00 00

Interestingly, this only occurs if the video stream is 4k HEVC HDR10 (playing direct stream so not transcoded).

Segfault doesn't happen with standard 4k HEVC HDR video files and TrueHD7.1 audio. I don't have any other types of HDR to test.

Containers are mkv.

Here's the (hopefully) relevant part from the main log in the dashboard. I'm refraining from posting the entire log as it's absolutely spammed full of thousands of repeats of these lines:

2022-10-16 22:38:28.602 Info Server: http/1.1 Response 404 to host1. Time: 1ms. http://192.168.1.100:8096/emby/videos/153573/hls1/main/1548.ts?PlaySessionId=11c4e0d69eef430ab689d43a22c86c17
2022-10-16 22:38:28.610 Info Server: http/1.1 GET http://192.168.1.100:8096/emby/videos/153573/hls1/main/1549.ts?PlaySessionId=11c4e0d69eef430ab689d43a22c86c17. Accept=*/*, Connection=keep-alive, Host=192.168.1.100:8096, User-Agent=libmpv, Icy-MetaData=1
2022-10-16 22:38:28.610 Error Server: Error processing request
	*** Error Report ***
	Version: 4.7.8.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Linux version 5.19.14-Unraid (root@Develop) (gcc (GCC) 12.2.0, GNU ld version 2.39-slack151) #1 SMP PREEMPT_DYNAMIC Thu Oct 6 09:15:00 PDT 2022
	Framework: .NET 6.0.8
	OS/Process: x64/x64
	Runtime: system/System.Private.CoreLib.dll
	Processor count: 16
	Data path: /config
	Application path: /system
	System.IO.FileNotFoundException: System.IO.FileNotFoundException: Unable to find the specified file.
	   at Emby.Server.MediaEncoding.Api.Hls.BaseHlsService.CreateRequestFromPlaySessionId(BaseSegmentRequest segmentRequest)
	   at Emby.Server.MediaEncoding.Api.Hls.DynamicHlsService.Get(GetHlsSegment segmentRequest)
	   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.MediaEncoding
	TargetSite: System.Tuple`3[Emby.Server.MediaEncoding.Api.StreamRequest,System.String,MediaBrowser.Controller.Net.AuthorizationInfo] CreateRequestFromPlaySessionId(Emby.Server.MediaEncoding.Api.Hls.BaseSegmentRequest)

I can see it says System.IO.FileNotFoundException, the file is obviously there and I can play the file fine with no playback issues when I select another audio stream line AC3 5.1.

I have attached the transcode log in case that contains anything helpful.

Thanks.

 

ffmpeg-transcode-2ac1a4cd-5c5f-4f88-b3ac-ee5274870e73_1.txt

Link to comment
Share on other sites

Hi, can you try resetting customizations back to defaults and see if that helps:

>>>> Non-Default Encoder Parameters Warning EncoderParametersH264LibX.Preset: Original: veryfast Actual: medium

 

Thanks.

 

 

Link to comment
Share on other sites

albumhaircut

It does help.

The highest quality setting I can use is 'faster'. Fast and medium (and the higher quality settings) are broken for me. Fast is actually the worst setting as it completely pegs one core to 100%. An attempt to restart the container failed and restarting the docker service just brought the server down. Oops.

I will use faster for now to try and get the best quality transcode.

Do you think this is unique to my machine? We you able to independently replicate it? I'm CPU transcoding and this machine has an AMD 5800x CPU.

Thanks

Link to comment
Share on other sites

albumhaircut

Oh dear, the issue is still present. It has been very hard to grab the logs as Emby keeps crashing and the container keeps crash looping.

I managed to get this from the attached log from the emby console logs one time when the container didn't crash loop.

Note - here's how I caused the issue:

  • I was using NVENC hardware encoding at the time to transcode the video streams.
  • Playback via web interface in Firefox to cause as much transcoding as possible
  • Encoder preset veryfast
  • Playing back 4 concurrent HEVC streams with a mix of TRUEHD7.1 and AC3 5.1 audio
  • ffmpeg seems to handle the audio streams
  • NVENC was handling the video streams

I did check through the logs in the dashboard, but didn't see much there. Happy to try and provide if the attached isn't enough.

 

embylog.txt

Link to comment
Share on other sites

  • 3 weeks later...

@albumhaircut - I'm totally confused. 

The conversation was about the encoder preset, but then you mention NVENC encoding to which that preset doesn't apply actually.

If you want us to look into this, we need a full server log and all ffmpeg logs.

Thanks.

 

Link to comment
Share on other sites

albumhaircut

Hi,

The conversation wasn't about the encoder preset, it was about a segfault when transcoding audio. I didn't mention anything about an encoder preset in my opening, Luke raised that point and asked if changing it made a difference. I provided an answer. 

I then provided a further scenario where the issue occurred again, this time when I was using NVENC hardware decoding for the video streams and ffmpeg handling the audio. I mentioned the encoder preset simply because I'd been asked about it/asked to alter it previously. Whether the encoder applies to NVENC doesn't seem like it should completely derail your understanding of the thread. 

But anyway, I'm not interested in pursuing the investigation as I fixed the problem. 

Thanks. 

Link to comment
Share on other sites

4 minutes ago, albumhaircut said:

Whether the encoder applies to NVENC doesn't seem like it should completely derail your understanding of the thread. 

What "derailed" my understanding of the thread is the lack of log files.

Link to comment
Share on other sites

I'm afraid, this just confused me because it didn't make much sense.

Would you mind letting us know what you found was the eventual issue?

Thanks

Link to comment
Share on other sites

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...