[RESOLVED] Does it read MKV Timecodes?

Anything related to video and my tools that is not a support request.
Post Reply
Posts: 1
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


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.

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

Re: Does it read MKV Timecodes?

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

Welcome to the forum, De-M-oN.

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.

Post Reply