Jump to content

Problem with Transcoding Media on iPhone Devices


Go to solution Solved by Carlo,

Recommended Posts

Magnoliiiia
Posted

Problem with Transcoding Media on iPhone Devices, Including Safari and Emby App

I am experiencing issues with transcoding media on iPhone devices, including both the Safari browser and the Emby app.

Specific Issues:

When decoding and playing MP4 media (e.g., "Family Guys"), the page continuously displays a loading circle.

Upon checking the transcoding log, the following error appears: "Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory."

Additional Testing:

  • Transcoding and playing this MP4 media on Xbox and PC using Chrome browser does not present the same issue.
  • Transcoding and playing MKV media on iPhone devices (including Emby app and Safari) does not present this issue.
  • When disabling hardware transcoding, the iPhone devices can transcode and play the MP4 media correctly.

I need help in resolving this problem. plz

 

embyserver.txt ffmpeg-transcode-ef195ea5-6a52-4e3c-aad1-cd3cae8844bf_1.txt

Happy2Play
Posted

Dev will have to comment more but don't think this has been mentioned before.

00:25:53.428 Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory

I don't see how but this topic suggest a UI issue.

 

  • Thanks 1
Magnoliiiia
Posted (edited)

I didn't find the "side menu" he mentioned, and it's strange that if I switch to software transcoding, the problem doesn't occur. The issue also doesn't happen with other videos using hardware transcoding. I even downloaded the Chrome browser on my iPhone, but the problem still persists.

IMG_3451.PNG

Edited by Magnoliiiia
upload png
Posted

Hi, so the problem is only on this one video?

Magnoliiiia
Posted (edited)
On 7/11/2024 at 2:48 PM, Luke said:

Hi, so the problem is only on this one video?

I tried several other videos, and this issue only occurs when hardware transcoding MP4 videos on iPhone devices. I also tried reinstalling the server, but the problem still persists.

Edited by Magnoliiiia
Posted

Hi, have you tried emby for iOS 2.2.23?

Magnoliiiia
Posted
On 7/18/2024 at 5:57 AM, Luke said:

Hi, have you tried emby for iOS 2.2.23?

That is I'm using now.

Posted

OK we're looking into this. Thanks.

  • 2 weeks later...
  • 2 weeks later...
Magnoliiiia
Posted

Yes, the issue still exists. I found that the problem might be related to the hardware encoder (H.264 <AVC>). If I choose Graphics 630-H.264 (AVC) instead of NVENC-H.264 (AVC), the playback on iOS works smoothly. Additionally, there are no issues with using NVENC-H.264 (AVC) in a computer browser, so I believe it's not a hardware issue.

Happy2Play
Posted
9 hours ago, Magnoliiiia said:

Yes, the issue still exists. I found that the problem might be related to the hardware encoder (H.264 <AVC>). If I choose Graphics 630-H.264 (AVC) instead of NVENC-H.264 (AVC), the playback on iOS works smoothly. Additionally, there are no issues with using NVENC-H.264 (AVC) in a computer browser, so I believe it's not a hardware issue.

Interesting as the devs may need the logs comparing both hardware methods of playback.

Posted
On 8/28/2024 at 2:51 PM, Happy2Play said:

Interesting as the devs may need the logs comparing both hardware methods of playback.

@Magnoliiiiaare you able to provide that? Thanks !

Magnoliiiia
Posted

I have uploaded logs for three different situations: The first log is MP4 media + NVENC-H.264 (AVC) + PC browser, which can play successfully. The second log is MP4 media + NVENC-H.264 (AVC) + iPhone Safari, which cannot play (it seems that due to errors and retries, multiple logs were generated, and I have packaged them together for upload). The third log is MP4 media + Graphics 630-H.264 (AVC) + iPhone Safari, which can play successfully. I have also uploaded the embyserver logs.

ffmpeg-transcode-2d9e2de2-b395-4b6a-991c-00ed9cd523f0_1.txt ffmpeg-trans.zip ffmpeg-transcode-b9a23bf7-e3ab-49de-bf01-4b0f118f33e7_1.txt embyserver.txt

Magnoliiiia
Posted
18 hours ago, Magnoliiiia said:

I have uploaded logs for three different situations: The first log is MP4 media + NVENC-H.264 (AVC) + PC browser, which can play successfully. The second log is MP4 media + NVENC-H.264 (AVC) + iPhone Safari, which cannot play (it seems that due to errors and retries, multiple logs were generated, and I have packaged them together for upload). The third log is MP4 media + Graphics 630-H.264 (AVC) + iPhone Safari, which can play successfully. I have also uploaded the embyserver logs.

ffmpeg-transcode-2d9e2de2-b395-4b6a-991c-00ed9cd523f0_1.txt 210.26 kB · 1 download ffmpeg-trans.zip 50.81 kB · 0 downloads ffmpeg-transcode-b9a23bf7-e3ab-49de-bf01-4b0f118f33e7_1.txt 155.97 kB · 0 downloads embyserver.txt 170.77 kB · 1 download

There is an error here. When I tested, I used Emby app, not Safari. However, the problem with both is the same.

zaHrecsohbiw
Posted
On 7/8/2024 at 7:36 PM, Magnoliiiia said:

Problem with Transcoding Media on iPhone Devices, Including Safari and Emby App

I am experiencing issues with transcoding media on iPhone devices, including both the Safari browser and the Emby app.

Specific Issues:

When decoding and playing MP4 media (e.g., "Family Guys"), the page continuously displays a loading circle.

Upon checking the transcoding log, the following error appears: "Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory."

Additional Testing:

  • Transcoding and playing this MP4 media on Xbox and PC using Chrome browser does not present the same issue.
  • Transcoding and playing MKV media on iPhone devices (including Emby app and Safari) does not present this issue.
  • When disabling hardware transcoding, the iPhone devices can transcode and play the MP4 media correctly.

I need help in resolving this problem. plz

 

embyserver.txt 1.97 MB · 4 downloads ffmpeg-transcode-ef195ea5-6a52-4e3c-aad1-cd3cae8844bf_1.txt 21.14 kB · 5 downloads

 

On 7/8/2024 at 9:20 PM, Happy2Play said:

Dev will have to comment more but don't think this has been mentioned before.

00:25:53.428 Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory

I don't see how but this topic suggest a UI issue.

 

Coincidentally, I posted about the exact same problem on the exact same day! 

I continue to wrestle with this. 

 

 

zaHrecsohbiw
Posted
On 8/28/2024 at 2:18 AM, Magnoliiiia said:

Yes, the issue still exists. I found that the problem might be related to the hardware encoder (H.264 <AVC>). If I choose Graphics 630-H.264 (AVC) instead of NVENC-H.264 (AVC), the playback on iOS works smoothly. Additionally, there are no issues with using NVENC-H.264 (AVC) in a computer browser, so I believe it's not a hardware issue.

I have this problem when using VAAPI with the iHD driver and HD 630 igpu. I had convinced myself that this problem was one of several that I've had that I chalked up to issues with arguments (or lack thereof) passed when using VAAPI, but it seems like your experience invalidates that.

Posted

Worth checking if you’re facing this issue. We were using the linuxserver.io image - switching to the official emby image fixed this for us

 

zaHrecsohbiw
Posted (edited)
On 9/8/2024 at 8:32 PM, Luke said:

@zaHrecsohbiwplease let us know if this helps. Thanks !

Darn! I was super excited because I too was running the linuxserver.io image. So, I switched, but, unfortunately this did not have any impact for me.

It's been hard to pin down exactly what needs to occur for this to fail. I think it may have something to do with a media file having multi-channel audio.

Bearing in mind that I have the Apple TV emby app set to prefer the native player (like others, I find that MPV is just unusable, frankly, on tvOS), I have noticed that if I have an mkv file with aac stereo and hevc, emby seems to know to immediately convert it to HLS. However, if an mkv file has, for instance, ac3 5.1, it appears to me that emby decides to send the mkv directly. Now... it does seem like after maybe 10 seconds or so, emby will attempt to transcode the file, but that's when this error pops up. the especially difficult part in all of this is that I have seen, on a rare occasion, playback manages to start. But when is say rare, I mean that's like ... I tested 20-30 different media files this weekend and it happened once. every other time, playback completely failed. Ive found it to be quite difficult to really nail down _precisely_ what is causing the failure though.

It kills me to see these same files load correctly on the web app. Im testing one now that failed to load on the Apple TV, but is working on safari, even though emby is transcoding for the safari playback. (although, in this particular case, the audio is, as expected, getting down mixed to stereo. god, if only I had a way to force 2-channel down mixing for the Apple TVs, as a way to test this. if that were the culprit, I would happily ride that out until multi-channel audio output selection was corrected)

 

Oh! one thing that occurred to me is that, when looking at the logs, it almost looks like the Apple TV player may be stopping playback around the time that emby decides to transcode the file. if emby server kills the transcoding folder because Apple TV stopped playback, then ffmpeg would obviously have nowhere to send the output files.

172ef7df67c7   emby/embyserver:latest                                 "/init"                  5 minutes ago   Up 5 minutes   1900/udp, 7359/udp, 0.0.0.0:8096->8096/tcp, :::8096->8096/tcp, 8920/tcp   
16:28:55.249 ffmpeg version 5.1-emby_2023_06_25 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC
16:28:55.249   built with gcc 10.3.0 (crosstool-NG 1.25.0)
16:28:55.249 Execution Date: 2024-09-10 16:28:55
>> ThrottleBySegmentRequest: Latest request position unknown
>> ThrottleBySegmentRequest: Latest request position unknown
16:28:59.475 Input #0, matroska,webm, from 'http://DELETED/DELETED.mkv':
16:28:59.475   Metadata:
16:28:59.475     encoder         : libebml v1.3.6 + libmatroska v1.4.9
16:28:59.475     creation_time   : 2018-10-22T02:57:43.000000Z
16:28:59.475   Duration: 00:21:34.72, start: 0.000000, bitrate: 8949 kb/s
16:28:59.475   Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], Level 40, 23.98 fps, 23.98 tbr, 1k tbn (default)
16:28:59.475     Metadata:
16:28:59.475       BPS-eng         : 8307714
16:28:59.475       DURATION-eng    : 00:21:34.710000000
16:28:59.475       NUMBER_OF_FRAMES-eng: 31042
16:28:59.475       NUMBER_OF_BYTES-eng: 1344510077
16:28:59.475   Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
16:28:59.475     Metadata:
16:28:59.475       BPS-eng         : 640000
16:28:59.475       DURATION-eng    : 00:21:34.720000000
16:28:59.475       NUMBER_OF_FRAMES-eng: 40460
16:28:59.475       NUMBER_OF_BYTES-eng: 103577600
16:28:59.475   Stream #0:2(eng): Subtitle: subrip
16:28:59.475     Metadata:
16:28:59.475       title           : English (SDH)
16:28:59.475       BPS-eng         : 110
16:28:59.475       DURATION-eng    : 00:21:22.281000000
16:28:59.475       NUMBER_OF_FRAMES-eng: 557
16:28:59.475       NUMBER_OF_BYTES-eng: 17741
16:28:59.476 Stream mapping:
16:28:59.476   Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
16:28:59.476   Stream #0:1 -> #0:1 (eac3 (native) -> ac3 (native))
16:28:59.476   Stream #0:2 -> #1:0 (subrip (srt) -> webvtt (native))
16:28:59.476   Stream #0:0 -> #1:1 (copy)
16:28:59.476 Press [q] to stop, [?] for help
16:28:59.538 Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
16:28:59.538 Error initializing output stream 0:0 -- 
16:28:59.540 Conversion failed!
16:28:59.540 EXIT

 

Edited by zaHrecsohbiw
Posted

I'm not an expert, but this looks like a Transcoding directory issues.

That might be permissions or a faulty path.

16:28:59.538 Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory

zaHrecsohbiw
Posted (edited)
9 minutes ago, JayceDK said:

I'm not an expert, but this looks like a Transcoding directory issues.

That might be permissions or a faulty path.

16:28:59.538 Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory

yeah the first time I saw this error I had the same thought, even though I had seen transcoding work. so I ran the command manually after exec'ing into the container and manually creating the specific folder, and the command worked as expected. 

this error only comes up alongside a circumstance where one of the emby apps (almost always Apple TV in my case) fails to play media (which makes sense). but as for transcoding in general, my emby configuration ends up transcoding media quite often with no issues.

The more I think about it, the more likely I find it that the actual cause of this specific error is that the Apple TV emby app has informed the server that it has stopped playing the media file, and as a result, emby server has deleted the folder before ffmpeg was closed. This would explain why some of my ffmpeg logs exit with _no_ error, but before any conversion output has been recorded.

 

So, I would say that you're probably correct to say that it's a "faulty path" in that the path does not exist by the time ffmpeg starts to write the file.

Edited by zaHrecsohbiw
Posted

I would guess dev's would need the full logs, to see the issue.

Full logs would help more than the snip you supplied 😊

zaHrecsohbiw
Posted

Yes, several more detailed logs have already been provided with respect to this issue in other threads, including the one that I linked to a few posts prior. 

Posted

Tbh you logs might be the missing link 😉

Posted
On 7/21/2024 at 1:21 PM, pdbear said:

hi admin,

I found emby 4.8.8.0 hardware transcoding failed with this key words:
```bash

Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
Error initializing output stream 0:0 --

```

when i create the dest directory on my hands, the transcoding works fine.

pls check the tanscode procedure,ffmpeg need create des path first。

 

like:

```bash

/var/packages/EmbyServer/target/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/var/packages/EmbyServer/var/logs/ffmpeg-transcode-20054eb9-0f59-4360-a8b0-a23543f915df_1graph.txt" -copyts -start_at_zero -init_hw_device "cuda=cuda:0" -f matroska,webm -c:v:0 h264 -threads:v:0 1 -hwaccel:v:0 cuda -hwaccel_output_format:v:0 cuda -noautorotate -c:v:1 mjpeg -i "/volume2/PT/电影/[大话西游之月光宝盒.星光联盟].A.Chinese.Odyssey.Part.One.Pandora's.Box.1995.SUBBED.WEB-DL.4K.H264.50FPS.AAC.Cantonese-OPS.mkv" -filter_complex "[0:0]scale_cuda@f1=w=640:h=360,setsar@f2=sar=sar[f2_out0]" -map [f2_out0] -map 0:1 -sn -c:v:0 h264_nvenc -b:v:0 808001 -g:v:0 150 -maxrate:v:0 808001 -bufsize:v:0 1616002 -keyint_min:v:0 150 -r:v:0 50 -profile:v:0 high -c:a:0 copy -metadata:s:a:0 language=chs -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/volume2/docker/emby_server/transcoding-temp/731266/731266.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 "/volume2/docker/emby_server/transcoding-temp/731266/731266_%d.ts"

```

the dest dir `/volume2/docker/emby_server/transcoding-temp/731266/` must created by emby but emby not do, especial this 731266 tmp directory.so ffmpeg report error. pls create the dest dir before start ffmpeg.

 

On 9/9/2024 at 9:40 AM, MarkBear said:

Worth checking if you’re facing this issue. We were using the linuxserver.io image - switching to the official emby image fixed this for us

 

It seems they are very close to the truth of the issue, specifically that the "dest" path is causing the problem. However, I tried reinstalling the official SPK file, but the issue still persists. Additionally, I noticed that PDBEAR's media contains Chinese paths, so I also tried using only English paths, but the problem remains unresolved. I further checked the /var/packages/EmbyServer/var/transcoding-temp path and found that the folders mentioned in the logs are being created normally. It feels like the hopes have been dashed again.

BTW, I would like to know, since the lifetime ID seems to be limited to 5 devices, does reinstalling the software count towards this limit? I plan to completely replace the hardware in the future to resolve this issue once and for all, but if the limit is reached, that would be quite unfortunate.

 

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