Thread: VirtualDub2
View Single Post
Old 7th November 2019, 14:53   #924  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
Quote:
Originally Posted by LigH View Post
Apropos ... the input driver concept seems to be the reason why you can't use VirtualDub2 to e.g. remultiplex MKV to MP4 in Stream Copy mode, correct?
The original idea of input driver in VD was like this:
1) input driver has to split source into packets and that`s all
2) video decoder has to take packets and no other metadata and translate that into frames

I may be missing some details but taking into account ordinary h264 video it is just impossible to implement accurate decoder in that way.
However, if focus is stream copy (decoder is not needed) then such input driver can work (splitting into packets is good enough).
At the same time the decoding phase is only good as preview - it is NEVER frame accurate.
This is how original AVI driver works, and also FCCHandler' matroska driver and quicktime driver.

Another approach was ffmpeg input driver - initially developed by FCCHandler according to some history of changes.
The idea with ffmpeg was to ignore packets altogether and deliver correct decoded frames right away (I think so, or maybe the idea was lost between changes).

What is blocking simultaneous support for copy and decode with ffmpeg? The core feature is being able to translate from packets to frames and back (timestamps also would be great): ffmpeg lacks this.
Current "caching input driver" has stretched this in some ways: it does switch to direct mode when packet-frame translation is trivial, this is the case with keyframe-only formats. Doing more than that needs more time and passion.

Why avidemux can work? It uses ffmpeg with some patches applied and afaik some custom made demuxers as well. Might be as good idea to either borrow his work or fix ffmpeg myself, both ways are not simple and stay in my internal 'todo' few years.
__________________
VirtualDub2
shekh is offline   Reply With Quote