Log in

View Full Version : 4K TV cannot play 4K H.264


wigor1
4th June 2019, 13:35
Hi,

If I re-encode 4K video in ffmpeg with default settings to H.264 it plays fine on several 4K TVs.

When I encode 4K video H.264 in my app using ffmpeg on C/C++ this 4K video doesn't play on 4K TVs (LG, Sony, Samsung).

I can't see any significant difference between video files in parameters:

https://www.dropbox.com/s/situh0d6khv1vx2/testvideo.zip?dl=0

Problem video on 4K TVs:
General
Complete name : D:\2\4K-TV-test\forum\testvideo\Problem-on-4K-TV.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 20.8 MiB
Duration : 28 s 29 ms
Overall bit rate : 6 214 kb/s
Writing application : Lavf58.20.100

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.2
Format settings, CABAC : Yes
Format settings, RefFrames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 28 s 29 ms
Duration_LastFrame : 17 ms
Bit rate : 5 959 kb/s
Nominal bit rate : 13.0 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 (59940/1000) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.012
Stream size : 19.9 MiB (96%)
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=abr / mbtree=1 / bitrate=13000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 27 s 29 ms
Bit rate mode : Constant
Bit rate : 256 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 846 KiB (4%)
Default : Yes
Alternate group : 1


This video plays fine on 4K TV:
General
Complete name : D:\2\4K-TV-test\forum\testvideo\ffmpeg-OK-on-4K-TV.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 40.0 MiB
Duration : 28 s 12 ms
Overall bit rate : 12.0 Mb/s
Writing application : Lavf58.20.100

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.2
Format settings, CABAC : Yes
Format settings, RefFrames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 28 s 12 ms
Bit rate : 11.9 Mb/s
Nominal bit rate : 13.0 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 (59940/1000) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.024
Stream size : 39.6 MiB (99%)
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=abr / mbtree=1 / bitrate=13000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 27 s 52 ms
Bit rate mode : Constant
Bit rate : 129 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 425 KiB (1%)
Default : Yes
Alternate group : 1


The problem is only with 3840 x 2160 60p video. 30p video plays fine.

ChaosKing
4th June 2019, 14:10
The problem is only with 3840 x 2160 60p video. 30p video plays fine.

This is your answer. I think that the HW decoder just doesn't support 60fps. What is the model name of the tv?

Atak_Snajpera
4th June 2019, 14:27
This video plays fine on 4K TV:

Frame rate : 59.940 (59940/1000) FPS

The problem is only with 3840 x 2160 60p video. 30p video plays fine.

So you say that 60fps works fine?

huhn
4th June 2019, 14:27
both examples are 59p (both are incorrect/not part of any spec btw)there are 2 differences i can see audio bit rate and video bit rate.

wigor1
4th June 2019, 15:07
Both videos were encoded with libx264.

Speaking 60p I meant 59.94p.

I encode video using ffmpeg C/C++ LibAV library. 3840 x 2160 59.94p

If I use NVENC encoder it plays fine on 4K TV.

If I use libx264 with same settings, 4K video doesn't play on 4K TV. However all sw players (VLC, etc) play fine this video.

Why you think that 59.94p is incorrect? I saw many video files with these parameters.
I didn't check true 60p video yet.

ChaosKing
4th June 2019, 15:09
In PotPlayer "ok" is shown as 59.94fps and "problem" as 59.905fps. I would try to remux the file and see if it helps. And test also without audio, just to be sure.

SeeMoreDigital
4th June 2019, 15:59
If you de-mux the video and audio streams to elementary streams and re-mux them to either, MP4, M2TS or MKV you'll find that MediaInfo reports the video stream runs 119.880 FPS!

EDIT: I forgot to mention that my LG 65UH770V is unable to play any of your provided files...

sneaker_ger
4th June 2019, 21:44
Maybe it's something about the timings/timescale.

Try:
ffmpeg -i Problem-on-4K-TV.mp4 -c copy -bsf:v "h264_metadata=tick_rate=120000/1001:fixed_frame_rate_flag=1" -video_track_timescale 60000 "output.mp4"

Also try:
ffmpeg -i Problem-on-4K-TV.mp4 -map 0 -c copy -to 00:27 "to27.mp4"

huhn
5th June 2019, 03:31
Both videos were encoded with libx264.

Speaking 60p I meant 59.94p.

I encode video using ffmpeg C/C++ LibAV library. 3840 x 2160 59.94p

If I use NVENC encoder it plays fine on 4K TV.

If I use libx264 with same settings, 4K video doesn't play on 4K TV. However all sw players (VLC, etc) play fine this video.

Why you think that 59.94p is incorrect? I saw many video files with these parameters.
I didn't check true 60p video yet.

PC video players don't care give them 53.8877 FPS and it will play it doesn't change it is not part of a major spec.

your files are not at the correct 59p fps which is 60000/1001 and not 59.940 (59940/1000) which is simply not the same. i think is unlikely but an internal media player in a Tv may reject bad to this they are at best unreliable anyway.