[RESOLVED] Does it read MKV Timecodes?

Anything related to video and my tools that is not a support request.
Post Reply
De-M-oN
Posts: 4
Joined: Tue Oct 10, 2017 3:53 pm

[RESOLVED] Does it read MKV Timecodes?

Post by De-M-oN » Tue Oct 10, 2017 5:36 pm

hi.

I'm capturing my capture card with ffmpeg.
The audio is in TMPGEnc VMW 6 at every position frameaccurate in sync with the video. (thats very impressive by ffmpeg to have such a perfect audio capture. just wow.)

I capture into NVEnc.

Thats what I use:

Code: Select all

ffmpeg -vstats_file "d:\XVideos\Lets Play Unreal\LP-Unreal_Level06_1.txt" -rtbufsize 1024M -f dshow -framerate 60 -thread_queue_size 1024 -probesize 10M -pixel_format bgr24 -i video="Datapath VisionSC-DP2 Video 01":audio="Wave (ASUS Xonar HDAV 1.3 Audio" -vf "vflip" -vcodec h264_nvenc -pix_fmt yuv420p -rc:v vbr -b:v 0 -qmin 1 -qmax 16 -preset hp -acodec pcm_s16le -audio_buffer_size 80 "e:\Lets Play Unreal\LP-Unreal_Level06_1.mkv"
The audio capture is like said frameaccurate in sync with TMPGEnc VMW 6, BUT:

I want to encode the video with ffmpeg as well, because TMPGEnc's Encoding is extremely slow even with NVEnc, but I need to encode it after the capture, because I want to upscale the video a little bit, because it greatly improves videoquality on youtube, because they give more bitrate then.

The problem is: lsmash and ffms2 - both do index the file (and so seem not to read any mkv timecodes, like TMPGEnc apparently does (it uses Intel Media SDK as decoder))

But the indexing loses the audio sync for some frames. If I add the fps number of the video the both readers it is reduced from about ~15 frames difference to 3 to 6, but sometimes again 10 frames of difference. I can move the audio a bit backwards to correct it to a very low difference, but it would be obviously more comfortable if it would simply use the apparently present timecodes of the mkv.
And if the timecodes result into a even FRAMEACCURATE audio sync I obviously get into the mood of wanting to stay with this even more perfect audio sync.

So my question now is: Can your reader read the timecodes of the mkv so that the audio remains its perfect audio sync and not just tmpgenc ?

That would be awesome if so.

admin
Site Admin
Posts: 3158
Joined: Thu Sep 09, 2010 3:08 pm

Re: Does it read MKV Timecodes?

Post by admin » Tue Oct 10, 2017 7:48 pm

Are you talking about having sync when playing from a random access? I don't quite understand your issue. Can you tell me what the problem is that you actually experience and what you have to do to experience it?

In the absence of seeking, I don't see how the indexing could be relevant. Serving linearly from the start just delivers decoded video frames, for which you'll know the specified frame rate. Meanwhile, the demuxed audio is available at its specified rate. If they are aligned at the start of a playback they remain aligned as both proceed at their specified rates.

Clarification of your question and specific issue will allow me to be more helpful. Do it in terms of what happens that causes a problem for you rather than in terms of specific technical questions that may assume too much.

More questions: Are you re-encoding the audio? How are you muxing the encode audio and video? I don't see any Avisynth script in your ffmpeg line. DGDecNV works through an Avisynth script, so how do you intend to map your current process to one using DGDecNV?

Final remark: I don't know what you mean by "my reader". I only give you an Avisynth source filter that delivers the decoded video frames via an Avisynth script. Everything beyond that is out of my hands. You would need to provide encoders and a muxer to recombine re-encoded video and audio streams into a container of your choice. DGDecNV is just a decoder/demuxer.

De-M-oN
Posts: 4
Joined: Tue Oct 10, 2017 3:53 pm

Re: [RESOLVED] Does it read MKV Timecodes?

Post by De-M-oN » Thu Oct 26, 2017 9:08 pm

I try it simple:

If I open the mkv file in TMPGEnc VMW 6 - I get video and audio in sync - even frameaccurate in sync - even if it is 5hour file.
If I open it with l-smash or ffms2 in avisynth - Audio is drifting away some frames. On the said 5 hour file and going to the 5th hour I'm already ~200ms or even higher, I didnt looked that up how much, but it was much on this point. TMPGEnc VMW 6 still frameaccurate in sync.
The audio difference is very low on normal files like 30min. But it can be 100ms there too.

So both decoders - ffms2 and l-smash - failed in audiosync compared to TMPGEnc VMW 6. Thats why I assume that TMPGEnc reads some special timecode info out of the mkv file and the ffms / lsmash just tries to guess it themself while the indexing.

But I did now the risk and bought your decoder and guess what? It works. It stays in sync with yours!

But 2 things:

1) https://abload.de/img/unbenannt5227zjxw.png
I had to extract the wav with mkvextract. No problem, but I wondered why DGIndex cant read a WAV file.

2) Resizing: Which resizing method is used? Spline? Lanczos? Bicubic? Or how is resolution scaling done? I see no info about it.

admin
Site Admin
Posts: 3158
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] Does it read MKV Timecodes?

Post by admin » Thu Oct 26, 2017 9:24 pm

1. That is specific to that particular audio format in an MKV file. I never had a file to use for developing that feature. That's why the error dialog asks you to send me one. If you can give me a link to your MKV there's a good chance I can support it.

2. For resizing DGIndexNV just uses GDI scaling, and DGDecodeNV uses some undocumented nVidia algorithm. It would be interesting to try to identify it by comparing it to some known Avisynth resizers.

admin
Site Admin
Posts: 3158
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] Does it read MKV Timecodes?

Post by admin » Sat Oct 28, 2017 3:41 pm

Any chance of getting a sample, De-M-oN?

De-M-oN
Posts: 4
Joined: Tue Oct 10, 2017 3:53 pm

Re: [RESOLVED] Does it read MKV Timecodes?

Post by De-M-oN » Sat Oct 28, 2017 7:14 pm

Should be doable by yourself:

Mux a WAV File into a MKV file and try to demux the WAV File with your DGIndexNV.exe program.

If you still want a file by me, I can give you then.

Post Reply