FAQ  •  Register  •  Login

H.264 High 4.0 not matching profile="high"

<<

mjb

User avatar

Streaming enthusiast

Posts: 45

Joined: Fri Jan 06, 2012 10:42 pm

Post Sun Jul 22, 2018 5:32 am

H.264 High 4.0 not matching profile="high"

My iPhone produces .mov files like this one, which 'ffmpeg -i' says this about:

  Code:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2018_06_16_IMG_1026.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2018-06-17T04:35:21.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone SE
    com.apple.quicktime.software: 11.4
    com.apple.quicktime.creationdate: 2018-06-16T22:35:21-0600
  Duration: 00:00:19.38, start: 0.000000, bitrate: 7635 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 7535 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2018-06-17T04:35:21.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 89 kb/s (default)
    Metadata:
      creation_time   : 2018-06-17T04:35:21.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-06-17T04:35:21.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-06-17T04:35:21.000000Z
      handler_name    : Core Media Data Handler


Here's the MediaInfo report for it:
  Code:
General
Complete name                            : G:\bittorrent\completed\2018_06_16_IMG_1026.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   0000.00 (qt  )
File size                                : 17.6 MiB
Duration                                 : 19 s 382 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 7 636 kb/s
Encoded date                             : UTC 2018-06-17 04:35:21
Tagged date                              : UTC 2018-06-17 04:35:41
Writing library                          : Apple QuickTime
com.apple.quicktime.make                 : Apple
com.apple.quicktime.model                : iPhone SE
com.apple.quicktime.software             : 11.4
com.apple.quicktime.creationdate         : 2018-06-16T22:35:21-0600

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 19 s 382 ms
Bit rate                                 : 7 534 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 29.970 (29970/1000) FPS
Minimum frame rate                       : 28.571 FPS
Maximum frame rate                       : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.121
Stream size                              : 17.4 MiB (99%)
Title                                    : Core Media Video
Encoded date                             : UTC 2018-06-17 04:35:21
Tagged date                              : UTC 2018-06-17 04:35:41
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : mp4a-40-2
Duration                                 : 19 s 380 ms
Source duration                          : 19 s 435 ms
Bit rate mode                            : Variable
Bit rate                                 : 89.5 kb/s
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 212 KiB (1%)
Source stream size                       : 212 KiB (1%)
Title                                    : Core Media Audio
Encoded date                             : UTC 2018-06-17 04:35:21
Tagged date                              : UTC 2018-06-17 04:35:41

Other #1
Type                                     : meta
Duration                                 : 19 s 382 ms
Bit rate mode                            : CBR

Other #2
Type                                     : meta
Duration                                 : 19 s 382 ms
Bit rate mode                            : CBR


My Blu-Ray player cannot play this file natively. It tries, and the audio plays, but the screen is black, and eventually it gives up. So I have to transcode it.

Here is the unusual part. Serviio does not transcode this file if I try to match it with a line like this:

  Code:
<Matches container="*" vCodec="h264" profile="high" levelGreaterThan="3.2"/>


...yet it does transcode the file if I take out the profile="high":

  Code:
<Matches container="*" vCodec="h264" levelGreaterThan="3.2"/>


I find this kind of weird because clearly FFmpeg did report that the video uses the High profile. Any idea why this is happening? I would expect it to work with the profile="high" in there.

Here is the debug log from before I took out profile="high". You can see that the video gets sent in native format, the player starts having trouble right away, and it starts requesting the file in smaller chunks. Serviio obliges, but it doesn't help:
https://pastebin.com/raw/BNp3Xi7v

Here is the debug log from after I took out profile="high". You can see the video is now transcoded, and it plays fine:
https://pastebin.com/raw/wcDuZHgc

[edit:] Just to be sure, I made a copy of the file and watched the log as it was added to the library. It seems the H.264 profile is being detected properly:

  Code:
2018-07-29 10:16:50,491 DEBUG [PipeManager] Adding file 'G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV' to the delta queue (file added)
2018-07-29 10:16:50,505 DEBUG [MediaFileIndexer] Found file 'G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV', checking if it's already in the Library
2018-07-29 10:16:50,505 DEBUG [MediaItemDAOImpl] Checking if DB already contains media item G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:50,505 DEBUG [MediaItemDAOImpl] Looking up a media item for file path: G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV, ignore case: true
2018-07-29 10:16:50,511 DEBUG [MediaItemDAOImpl] Media item G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV doesn't exist in DB yet
2018-07-29 10:16:50,511 DEBUG [MediaFileIndexer] File not in Library, will add it
2018-07-29 10:16:50,511 DEBUG [LibraryHelper] Checking if the file is complete using file lock
2018-07-29 10:16:50,516 DEBUG [LibraryHelper] Checking if the file is complete using file size
2018-07-29 10:16:51,266 DEBUG [LibraryHelper] File is complete with size 18499500
2018-07-29 10:16:51,266 DEBUG [VideoExtractionStrategy] Extracting metadata of video file: G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:51,266 DEBUG [FFMPEGWrapper] Invoking FFMPEG to retrieve media information for file: G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:51,266 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\bin\\..\lib\ffmpeg.exe -i G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:53,483 DEBUG [FFmpegMetadataRetriever] Retrieving H264 profile/level for file 'G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV'
2018-07-29 10:16:53,483 DEBUG [FFMPEGWrapper] Invoking FFMPEG to retrieve H264 header for file: G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:53,483 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\bin\\..\lib\ffmpeg.exe -i G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV -frames:v 1 -c:v copy -f h264 -bsf:v h264_mp4toannexb -an pipe:
2018-07-29 10:16:53,739 DEBUG [FFmpegMetadataRetriever] File 'G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV' has H264 profile HIGH, levels [{H=4, RF=3.1}] and 1 ref frames
2018-07-29 10:16:53,739 DEBUG [FFMPEGWrapper] Invoking FFMPEG to retrieve thumbnail for file: G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:53,739 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\bin\\..\lib\ffmpeg.exe -threads 2 -ss 9 -i G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV -an -frames:v 1 -f image2 pipe:
2018-07-29 10:16:54,092 DEBUG [OpenSubtitlesService] Generating hash code for opensubtitles.org for file 2018_06_16_IMG_1026 - Copy.MOV
2018-07-29 10:16:54,296 DEBUG [MetadataExtractionCoordinator] Metadata found via extractor EMBEDDED: VideoMetadata [title=2018_06_16_IMG_1026 - Copy, filePath=G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV, fileSize=18499500, audioTracks=1/AAC/89/1/44100//true, bitrate=7635, container=MP4, contentType=UNKNOWN, rating=null, duration=19, episodeNumber=null, fps=29.97, h264Levels={H=4, RF=3.1}, h264Profile=HIGH, ftyp=qt, height=1080, seasonNumber=null, seriesName=null, timestampType=null, videoBitrate=7535, videoCodec=H264, videoFourCC=avc1, videoStreamIndex=0, width=1920, embeddedSubtitles=[]]
2018-07-29 10:16:54,297 DEBUG [VideoService] Adding video into database: 2018_06_16_IMG_1026 - Copy
2018-07-29 10:16:54,298 DEBUG [CoverImageService] Resizing and storing cover art image for max resolution of 320x320
2018-07-29 10:16:54,323 DEBUG [ImageUtils] Starting image resize, size = 80963 bytes
2018-07-29 10:16:57,037 DEBUG [ImageUtils] Returning resized image, size = 9488 bytes
2018-07-29 10:16:57,037 DEBUG [CoverImageService] Image successfully resized
2018-07-29 10:16:57,037 DEBUG [CoverImageService] Resizing and storing cover art image for max resolution of 160x160
2018-07-29 10:16:57,037 DEBUG [ImageUtils] Starting image resize, size = 9488 bytes
2018-07-29 10:16:57,052 DEBUG [ImageUtils] Returning resized image, size = 3340 bytes
2018-07-29 10:16:57,052 DEBUG [CoverImageService] Image successfully resized
2018-07-29 10:16:57,052 DEBUG [CoverImageDAOImpl] Creating a new ImageCover (length = 3340)
2018-07-29 10:16:57,404 DEBUG [VideoDAOImpl] Creating a new Video (title = 2018_06_16_IMG_1026 - Copy)
2018-07-29 10:16:57,825 DEBUG [GenreDAOImpl] Retrieving list of genres for media item 13929
2018-07-29 10:16:57,871 DEBUG [MetadataDescriptorDAOImpl] Creating a new MetadataDescriptor (type = EMBEDDED, mediaItemId = 13929)
2018-07-29 10:16:58,049 INFO  [SearchManager] Starting up search engine
2018-07-29 10:16:59,504 INFO  [MediaFileIndexer] Added file 'G:\bittorrent\completed\2018_06_16_IMG_1026 - Copy.MOV' (title: 2018_06_16_IMG_1026 - Copy) to Library
2018-07-29 10:17:02,609 DEBUG [AbstractCDSLibraryIndexingListener] Library updated, notifying CDS
2018-07-29 10:17:02,618 DEBUG [LocalContentCacheDecorator] Cleared cache (local_resetafterplay)
2018-07-29 10:17:02,618 DEBUG [LocalContentCacheDecorator] Cleared cache (local_default)
2018-07-29 10:17:09,161 DEBUG [SearchManager] Committing search index


So the mystery remains.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16803

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Aug 15, 2018 8:38 am

Re: H.264 High 4.0 not matching profile="high"

try with levelGreaterThan="3"

Serviio detected level 4 (based on the file header metadata value) and 3.1 (based on a formula computation using ref frames). Does you profile (or its parent) have H264LevelCheck element? If it's ANY, the higher of these 2 values would be used for mathing, if it's FILE_ATTRIBUTES it'd use 3.1, otherwise 4.
<<

mjb

User avatar

Streaming enthusiast

Posts: 45

Joined: Fri Jan 06, 2012 10:42 pm

Post Wed Aug 29, 2018 5:44 pm

Re: H.264 High 4.0 not matching profile="high"

Ah, that explains it. I am extending profile 7 (Samsung C/D), which extends sam_ef, which extends sam_h, which sets H264LevelCheck to FILE_ATTRIBUTES.

If I set H264LevelCheck to ANY in my child profile, will that apply only to the things in that profile, or will it also apply to the inherited parts?
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16803

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Aug 31, 2018 9:08 pm

Re: H.264 High 4.0 not matching profile="high"

to everything.

Return to Transcoding

Who is online

Users browsing this forum: No registered users and 4 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.