[Solved] Samsung UE40D5500 - MP4 format problem

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
mykee
Posts: 19
Joined: Sun Sep 11, 2016 9:56 pm

[Solved] Samsung UE40D5500 - MP4 format problem

Post by mykee »

I have the TV in the title. I would like to play the following file recorded on my mobile phone:

Code: Select all

General
Complete name                            : H:\!Képeink2\kiki2\Zsu Honor 6\VID_20241116_173351.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 638 MiB
Duration                                 : 5 min 10 s
Overall bit rate                         : 17.2 Mb/s
Frame rate                               : 30.032 FPS
Encoded date                             : 2024-11-16 16:33:51 UTC
Tagged date                              : 2024-11-16 16:33:51 UTC
com.android.version                      : 14

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 5 min 10 s
Source duration                          : 5 min 10 s
Bit rate                                 : 17.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 30.032 FPS
Minimum frame rate                       : 29.940 FPS
Maximum frame rate                       : 30.120 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.273
Stream size                              : 629 MiB (98%)
Source stream size                       : 629 MiB (98%)
Title                                    : VideoHandle
Language                                 : English
Encoded date                             : 2024-11-16 16:33:51 UTC
Tagged date                              : 2024-11-16 16:33:51 UTC
Color range                              : Full
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.709
transfer_characteristics_Original        : BT.601
Matrix coefficients                      : BT.601
mdhd_Duration                            : 310323
Codec configuration box                  : avcC

Audio
ID                                       : 1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 5 min 10 s
Bit rate mode                            : Constant
Bit rate                                 : 256 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 9.47 MiB (1%)
Title                                    : SoundHandle
Language                                 : English
Encoded date                             : 2024-11-16 16:33:51 UTC
Tagged date                              : 2024-11-16 16:33:51 UTC
I use the following custom configuration file in addition to the standard Samsung-CD.conf file:

Code: Select all

# Supported video formats:
Supported = f:3gp             v:divx|mp4|h264|mjpeg|mpeg1|mpeg2|vc1|wmv|h263|vp6    a:ac3|lpcm|adpcm|aac-lc|he-aac|wma|eac3|mp3|dts           m:video/3gpp
Supported = f:avi             v:divx|h264|mjpeg|mp4|xvid                            a:aac-lc|he-aac|ac3|dts|mp3|mpa                           m:video/avi
Supported = f:mkv             v:h264|h265|mp4|mpeg2|vp8                             a:aac-lc|he-aac|ac3|dts|mp3|mpa|vorbis                    m:video/x-matroska
Supported = f:mov             v:h264|h265|mp4                                       a:aac-lc|he-aac|ac3|adpcm|dts|eac3|lpcm|mp3|wma           m:video/quicktime
Supported = f:mp4|m4v         v:h264|h265|divx|mp4|avc1|mpeg1|mpeg2|vc1|wmv|h263|vp6     a:aac-lc|he-aac                                           m:video/mp4
Supported = f:mpegps          v:mpeg1|mpeg2                                         a:ac3|lpcm|mpa                                            m:video/mpeg
Supported = f:mpegts          v:h264|mpeg2                                          a:aac-lc|he-aac|ac3|dts|eac3                              m:video/mpeg
Supported = f:webm            v:vp8                                                 a:vorbis                                                  m:video/webm
Supported = f:wmv             v:divx|mp4|h264|mjpeg|mpeg1|mpeg2|vc1|wmv|h263|vp6    a:ac3|lpcm|adpcm|aac-lc|he-aac|wma|eac3|mp3|dts           m:video/x-ms-wmv
Supported = f:asf             v:divx|mp4|h264|mjpeg|mpeg1|mpeg2|vc1|wmv|h263|vp6    a:ac3|lpcm|adpcm|aac-lc|he-aac|wma|eac3|mp3|dts           m:video/x-ms-asf
Supported = f:flv             v:divx|mp4|h264|mjpeg|mpeg1|mpeg2|vc1|wmv|h263|vp6    a:ac3|lpcm|adpcm|aac-lc|he-aac|wma|eac3|mp3|dts           m:video/x-flv
When I try to play the video, the TV returns an Unsupported format error. If I enter mp4 format in the UMS settings to Skip transcoding, it plays without any problem.

Here is my FFMpeg settings:
UMS-FFMPEG.jpg
UMS-FFMPEG.jpg (166.33 KiB) Viewed 8303 times
I see this line in Log:

Code: Select all

19:33:52 INFO  Process N:\!Programok\Universal Media Server\bin\ffmpeg.exe has a return code of -22! Maybe an error occurred... check the log file
What is missing from the configuration file or what is set wrong? Why does UMS want to encode with ffmpeg if it is a supported format?
User avatar
mik_s
Moderator
Posts: 1445
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: Samsung UE40D5500 - MP4 format problem

Post by mik_s »

Your phone is probably encoding to a higher level than your TV can decode.
That video is using [email protected] but as your TV is very old it might only be able to do 4.1

There is an option you set in the conf so higher levels are transcoded instead, but the default is 4.1 anyway.

Code: Select all

# The maximum H.264 level supported by the renderer.
# Default: 4.1
H264LevelLimit =
As you are getting an error message form FFmpeg something else could be wrong but I will need to see the logs to see what it is. See the section in red above.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
mykee
Posts: 19
Joined: Sun Sep 11, 2016 9:56 pm

Re: Samsung UE40D5500 - MP4 format problem

Post by mykee »

The log file is here for ffmpeg error:
ums_dbg_2025-01-04-21-52.zip
(92.94 KiB) Downloaded 658 times
The solution was to increase the Level. I added this line to the custom config file and the video starts:

Code: Select all

H264LevelLimit = 5.1
It may have been added in a firmware update, although I couldn't find any official info about it, but the video works.

So I can now play the mp4 in question, but those videos that need to be transcoded (such as vp9 videos) may still have problems.

And here is VP9 log too (UMS not encoded over the TV):
ums_dbg_2025-01-04-22-07.zip
(98.09 KiB) Downloaded 660 times
User avatar
mik_s
Moderator
Posts: 1445
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: Samsung UE40D5500 - MP4 format problem

Post by mik_s »

There is an error about a colour range in the first video and an invalid argument.

Code: Select all

net.pms.io.OutputTextLogger   Stream #0:1[0x2](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, reserved/reserved/smpte170m, progressive), 1920x1080, 16996 kb/s, 30.03 fps, 30 tbr, 90k tbn (default)
net.pms.io.OutputTextLogger       Metadata:
net.pms.io.OutputTextLogger         creation_time   : 2024-11-16T16:33:51.000000Z
net.pms.io.OutputTextLogger         handler_name    : VideoHandle
net.pms.io.OutputTextLogger         vendor_id       : [0][0][0][0]
net.pms.io.OutputTextLogger Stream mapping:
net.pms.io.OutputTextLogger   Stream #0:1 -> #0:0 (h264 (native) -> mpeg2video (native))
net.pms.io.OutputTextLogger   Stream #0:0 -> #0:1 (aac (native) -> ac3 (native))


net.pms.io.OutputTextLogger [graph 0 input from stream 0:1 @ 0000024f581ee8c0] Invalid color range
net.pms.io.OutputTextLogger [vf#0:0 @ 0000024f582e0500] Error reinitializing filters!
net.pms.io.OutputTextLogger [vf#0:0 @ 0000024f582e0500] Task finished with error code: -22 (Invalid argument)
net.pms.io.OutputTextLogger [vf#0:0 @ 0000024f582e0500] Terminating thread with return code -22 (Invalid argument)
But don't know what is causing it.


That second video is transcoding as the resolution is too big for the TV so it is being re-scaled, but I think this is not working right as I have seen similar problems before with the filter_complex argument that does that scaling but don't know enough on how to fix.

Code: Select all

net.pms.io.ProcessWrapperImpl Starting "N:\!Programok\Universal Media Server\bin\ffmpeg.exe" -y -loglevel info -hwaccel cuda -threads 1 -i "H:\!Képeink2\kiki2\Zsu Honor 6\TOLVAI RENI-20250104-DEZ2Qkti6fD-Video by tolvaireni-00001.mp4" -filter_complex [0:v]scale=iw*min(1920/iw\,1080/ih):ih*min(1920/iw\,1080/ih),[0:v]pad=ceil(iw/4)*4:ceil(ih/4)*4:(ow-iw)/2:(oh-ih)/2 -threads 16 -bufsize 1835k -maxrate 24000k -g 25 -qmin 2 -qmax 5 -ab 448k -ar 48000 -c:a ac3 -c:v mpeg2video -f vob \\.\pipe\ffmpegvideo_129_1736024827797
Looks like the width and height values are swapped unless the video has been rotated.

Code: Select all

net.pms.configuration.RendererConfiguration Resolution 1080x1920 is too high for this renderer, which supports up to 1920x1080
I don't see an error with FFmpeg with this one but the connection is reset by the TV so it does not like something.

Code: Select all

net.pms.network.HttpServletHelper Sending stream with premature end: 131072 bytes. Reason: Connection reset by peer
Looking at your UMS.conf it still has old settings that have been moved, changed or not used anymore so must have been using UMS for a long time.
Might be worth doing a clean install and keep everything at defaults to see if transcoding will work properly, and if it does you can start restoring them to what you had them and see if anything breaks. Make a backup of "C:\ProgramData\UMS" just incase but would be better to do the settings by hand. This will also backup your custom conf for the TV.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
mykee
Posts: 19
Joined: Sun Sep 11, 2016 9:56 pm

Re: Samsung UE40D5500 - MP4 format problem

Post by mykee »

I just did a clean install and only included the folder where the mobile videos are. I get the same ffmpeg -22 error, I attach the log.
ums_dbg_2025-01-12-08-49.zip
(122.71 KiB) Downloaded 656 times
I don't see an error with FFmpeg with this one but the connection is reset by the TV so it does not like something.
How can I set in the TV config file to not send the larger sizes and to encode the largest side to the highest resolution height or width of the TV?
User avatar
mik_s
Moderator
Posts: 1445
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: Samsung UE40D5500 - MP4 format problem

Post by mik_s »

MaxVideoWidth and MaxVideoHeight set the supported size of the video, any higher will need to be transcoded to be scaled down to fit.
The default value will be correct so you don't need to set them for this TV.

Code: Select all

# The maximum width and height supported by the renderer. 0 means unlimited.
# Both must be 0, or both must be higher than 0.
# Defaults: 1920 and 1080
MaxVideoWidth = 
MaxVideoHeight = 
I compared the transcoding command in this one to the one I posted previously and it is mostly the same, the only difference is using the GPU and scaling but that was not the cause of the previous problem so I think this was right.

I think something must be wrong with the FFmpeg command arguments if it is still giving that error. Maybe some other setting would fix it.

I'll make an issue on Github so the devs can have a look.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
User avatar
SubJunk
Lead Developer
Posts: 3804
Joined: Sun May 27, 2012 4:12 pm

Re: Samsung UE40D5500 - MP4 format problem

Post by SubJunk »

Hmm it looks like there are at least 2 problems here.

The H.264 level support change will be merged in the next version of UMS.

But FFmpeg seems to have introduced a problem in v7 with color space defaults https://fftrac-bg.ffmpeg.org/ticket/11020
So that is up to them to fix
Post Reply