Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th January 2022, 11:49   #1  |  Link
exekutive
Registered User
 
Join Date: Nov 2020
Posts: 2
Some AVC files unplayable in Quicktime

It has happened to me a few times that an h.264 MP4 file will not play in Quicktime player, but does in most other software. When I press play, there's is a long pause, and after a few seconds the elapsed time starts to count up. The video freezes on one of the first frames, and the audio plays in the background. I'm trying to find out what would cause it not to play.

I have tried remuxing a file, but that did not help. Removing the audio didn't help either. One common theme seems to be they were encoded by Lavf58.12.100 (other versions work fine)

Here is some technical info from one example file that doesn't play:


Code:
General
Complete name                            : /Users/joe/stage/corrupt.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 527 MiB
Duration                                 : 40 min 39 s
Overall bit rate                         : 1 812 kb/s
Encoded date                             : UTC 2020-08-08 11:08:03
Tagged date                              : UTC 2020-08-08 11:08:03
major_brand                              : isom
minor_version                            : 0
compatible_brands                        : isommp42
creation_time                            : 2020-08-08T11:08:03.000000Z
encoder                                  : Lavf58.12.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=1, N=12
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 40 min 39 s
Bit rate                                 : 1 614 kb/s
Width                                    : 960 pixels
Height                                   : 544 pixels
Display aspect ratio                     : 16:9
Original display aspect ratio            : 16:9
Frame rate mode                          : Variable
Frame rate                               : 23.976 (23976/1000) FPS
Minimum frame rate                       : 11.987 FPS
Maximum frame rate                       : 59.733 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.129
Stream size                              : 469 MiB (89%)
Language                                 : English
Encoded date                             : UTC 2020-08-08 11:08:03
Tagged date                              : UTC 2020-08-08 11:08:03
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 40 min 39 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 55.8 MiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2020-08-08 11:08:03
Tagged date                              : UTC 2020-08-08 11:08:03
Frame header output from 'h264_analyze' tool (first 100 KB)
https://pastebin.com/wW2kYZPC


avcC header (extradata) of MP4 file:
Code:
61766343 0142C01F FFE20020 6742C01F 95A03C04 5B011000 003E9000 0EA60E00 000493E0 000493E1 BBCB8280 00176742 C01F5680 F0116C04 40000003 00400000 0E03C60C A8020004 68CE3C80 00046848 E3C8
Output of 'ffprobe -show_streams -show_data' :
https://pastebin.com/9RDB90gC


It has been suggested that Quicktime Player might not support 8x8 macroblocks, or multiple b-frames.
But here is a video which I think was encoded with both those features, and it plays fine in QT

https://www.sendspace.com/file/59pn6x
Code:
6.2: sps->direct_8x8_inference_flag: 1 
6.4: pps->transform_8x8_mode_flag: 1 
4.2: pps->weighted_bipred_idc: 2
I am open to any suggestions. Thanks.
exekutive is offline   Reply With Quote
Old 22nd January 2022, 01:24   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,142
QuickTime has supported 8x8 and B-frames for a really long time now. I know the Apple encoder didn't use Open GOP for a really long time, so that is a potential issue if you're using them.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th January 2022, 09:32   #3  |  Link
exekutive
Registered User
 
Join Date: Nov 2020
Posts: 2
Thanks.

GOP starts like this: https://pastebin.com/N6ta7akv
M=1, N=12
exekutive is offline   Reply With Quote
Old 26th January 2022, 18:10   #4  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,142
Did you encode the H.264 elementary stream, or is it from some other source? It's much easier to debug if you know and can control the parameters. But if all you have is a file encoded by someone else, it might have some fundamental bitstream error and you might just have to reencode it to get it to work. You've already done the basic troubleshooting I recommend by remuxing and trying without audio.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 18th June 2022, 04:15   #5  |  Link
perrinpages
Registered User
 
Join Date: Feb 2022
Posts: 7
I've had some issues with h264 or h265 videos not playing on apple devices when they clearly should. I extracted the bitstreams using ffmpeg, remuxed using bento4's mp4 muxer, and then finally remuxed using ffmpeg to add the audio track back in. It's a convoluted process, but it works. I believe it has something to do with metadata/timestamps being stripped when extracting the raw h264 then regenerating the metadata and timestamps using an updated muxer such as bento4. modern ffmpeg versions don't seem to support generating timestamps when remuxing streams no matter what command, so use bento4. I noticed in mediainfo your frame rate is listed as variable and has a wide range, so if its frame rate truly is what's listed in mediainfo and not corrupted timestamps, you will have sync issues. If your source has a constant frame rate, this method should not cause sync issues.
perrinpages is offline   Reply With Quote
Old 18th June 2022, 22:24   #6  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 2,209
Quote:
Originally Posted by perrinpages View Post
I extracted the bitstreams using ffmpeg, remuxed using bento4's mp4 muxer, and then finally remuxed using ffmpeg to add the audio track back in. It's a convoluted process, but it works.
If the muxer is the issue, you can use MP4Box to remux both video and audio. Anyway, I strongly encourage people encoding H.264 files in MP4 that have to be played everywhere and need maximum compatibility to:

1) Use constant frame rate and not VFR
2) Use 8bit
3) Not exceed --ref 4
4) Not exceed --level 4.1
5) Use Closed GOP
6) Use --keyint = framerate (23,976p --keyint 24, 25p --keyint 25, 29,970 --keyint 30 etc)
7) Mux using MP4Box as a muxer
FranceBB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.