AkarinVS / L-SMASH-Works

Works based on L-SMASH project; This repo focuses on the common portion and the VapourSynth plugin. AviSynth users please use https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works. ffmpeg 5.0+ please use ffmpeg-4.5 branch.
48 stars 11 forks source link

Indexing issues on ZLog2 HDR H.265 UHD file #18

Closed FranceBB closed 3 years ago

FranceBB commented 3 years ago

Hi there, I have the following ZLog2 HDR H.265 UHD file which lasts 3 minutes and fails to index in LWLibavVideoSource. It indexes in FFMpegSource2, however, if I call x262 or FFMpeg or VirtualDub and I try to encode it, it gets to 1 minute and 30 seconds and then it stops, concluding the encode.

Mediainfo:

General
Complete name                            : T:\_RUBRICHE\MASSIMO\A002C0023_20211019172852_0001.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   2004.06 (qt  )
File size                                : 2.49 GiB
Duration                                 : 3 min 0 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 119 Mb/s
Encoded date                             : UTC 2021-10-19 15:28:52
Tagged date                              : UTC 2021-10-19 15:28:52
com.zcam.camera.prepend                  : v0
CameraMaker                              : Z CAM
CameraModel                              : E2-F6
com.zcam.camera.sn                       : 540D00A1298
com.zcam.camera.fw                       : 0.98.0
com.zcam.camera.movieType                : MOVIE
com.zcam.camera.lut                      : Z-Log2
com.zcam.camera.iso                      : 400
com.zcam.camera.storage                  : AVpro256
com.zcam.camera.nd                       : clear
com.zcam.camera.extendedManualIso        : Off
com.zcam.camera.whiteBalanceMode         : Manual
com.zcam.camera.whiteBalanceKelvin       : 5600K
com.zcam.camera.whiteBalanceTint         : 0
com.zcam.camera.sharpness                : Strong
com.zcam.camera.noiseReduction           : Weak
com.zcam.camera.projectFps               : 25
com.apple.proapps.shootingRate           : 25
com.zcam.camera.captureVfr               : 50
com.apple.proapps.cameraName             : A
com.apple.proapps.reel                   : 002
com.zcam.camera.battery                  : 14.5V
com.zcam.camera.temperature              : 48.6°C
com.zcam.camera.shutterAngle             : 37.5°
com.zcam.camera.splitIndex               : 0
com.apple.proapps.clipID                 : A002C0023_20211019172852_0001
com.zcam.camera.hash                     : 36bb

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@Main
HDR format                               : SMPTE ST 2086, HDR10 compatible
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 3 min 0 s
Bit rate                                 : 117 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.566
Stream size                              : 2.47 GiB (99%)
Language                                 : English
Encoded date                             : UTC 2021-10-19 15:28:52
Tagged date                              : UTC 2021-10-19 15:28:52
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Mastering display color primaries        : BT.709
Mastering display luminance              : min: 0.0000 cd/m2, max: 0 cd/m2
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 min 30 s
Bit rate mode                            : Variable
Bit rate                                 : 128 kb/s
Maximum 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                              : 1.35 MiB (0%)
Language                                 : English
Encoded date                             : UTC 2021-10-19 15:28:52
Tagged date                              : UTC 2021-10-19 15:28:52

Other
ID                                       : 3
Type                                     : Time code
Format                                   : QuickTime TC
Duration                                 : 3 min 0 s
Frame rate                               : 25.000 FPS
Time code of first frame                 : 17:28:52:00
Time code, striped                       : Yes
Title                                    : 002
Language                                 : English
Encoded date                             : UTC 2021-10-19 15:28:52
Tagged date                              : UTC 2021-10-19 15:28:52

Simple AVS Script 1:

FFMpegSource2("T:\_RUBRICHE\MASSIMO\A002C0023_20211019172852_0001.MOV", atrack=-1)

Expected behavior:

The file is supposed to be indexed correctly with the whole 3 minutes.

Actual behavior:

The index completes, going through AVSPmod shows 3 minutes of file with 4515 frames, but once I try to save it with VirtualDub or with FFMpeg or with x262, it gets to 1 minute and 30 seconds and then it stops.

Simple AVS Script 2:

LWLibavVideoSource("T:\_RUBRICHE\MASSIMO\A002C0023_20211019172852_0001.MOV")

Expected behavior:

The file is supposed to be indexed correctly with the whole 3 minutes.

Actual behavior:

[Fatal]: Failed to avformat_open_input

Simple AVS Script 3:

DirectShowSource("T:\_RUBRICHE\MASSIMO\A002C0023_20211019172852_0001.MOV", audio=true)

Using DirectShowSource to decode it with LAV Filters works.

Original Masterfile: https://sendgb.com/PDikx79WNLX File indexed with ffms2 and encoded with stops after 1 minute and 30 seconds: https://we.tl/t-25Z0elmGtr File indexed with DSS and encoded which goes on 'till the end: https://we.tl/t-MMsU2XIhNN

AkarinVS commented 3 years ago

Which version of lsmas are you using?

I didn't test the AVS version, but as it fails during indexing, it should also reproduce with the VS version as well. I couldn't reproduce it using the latest version though.

lsmas correctly indexed 4516 frames and playback seems fine as well.

If lsmas reports "Failed to avformat_open_input." then it's likely that your lsmas is not built with newer ffmpeg that could handle the file.

If you can't test using VapourSynth, perhaps try this release, https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/tag/20210811, as it should be close enough.

FranceBB commented 3 years ago

I was using the one built on Monday 09 August 2021 at 17.54.44. I'm using Avisynth 3.7.1 Development Snapshot 23 x64. If I try to index any other file in that folder, it works just fine:

image

but not that one:

image

This happens on Windows 11 Enterprise x64.

I've now swapped it with the one you linked, built on Tuesday 10 August 2021 at 21:06:46 (so essentially it's 1 day newer than mine) and surprise surprise, it works:

image

My mind is blown...

AkarinVS commented 3 years ago

I don't see https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works released anything on 09 August 2021, so perhaps you were using another build, which could be using an older version of ffmpeg.

This problem is most likely caused by an issue in ffmpeg itself, not in lsmas. (If you have the time, you could try HomeOfAviSynthPlusEvolution's earlier releases as well, I bet all releases built with ffmpeg 4.4 would work.)