artclarke / humble-video

Humble Video: Demuxing, Decoding, Filtering, Encoding and Muxing of 100's of video and audio formats and Codecs from the JVM
GNU Affero General Public License v3.0
557 stars 115 forks source link

Humble video decodes video with wrong timestamps using DecodeAndPlay demo (video attached) #146

Open Rubydesic opened 4 years ago

Rubydesic commented 4 years ago

I just tried to play this video on the 'DecodeAndPlay' demo, and it gets played at 0.47 fps, the timestamps are all messed up on each frame. If I want it to play at around 60fps I have to divide every timestamp by 128: var streamTimestamp = picture.timeStamp / 128 in the first line of displayVideoAtCorrectTime.

How should I go about correctly decoding this video's timestamps?

Video file: https://mega.nz/file/KYtlDDrI#a-CYsajoLvg22VNT_jQfK_-rOemoIpes91uRpgm9Uf8

MediaInfo:

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 63.2 MiB
Duration                                 : 1 min 36 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 5 511 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.2
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 min 36 s
Bit rate mode                            : Variable
Bit rate                                 : 5 489 kb/s
Maximum bit rate                         : 40.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 60.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.044
Stream size                              : 62.9 MiB (100%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.470 System B/G
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 min 36 s
Bit rate mode                            : Variable
Bit rate                                 : 10.2 kb/s
Maximum bit rate                         : 160 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                              : 120 KiB (0%)
Title                                    : Track1
Default                                  : Yes
Alternate group                          : 1