-
Notifications
You must be signed in to change notification settings - Fork 231
Feature request: Add seek by time stamp (Same question with issue#232) #561
Comments
Hi @chenj133 Demuxer only extracts the encoded packets from the input file. It’s here where the seek operation happens. Demuxing is indeed done on the CPU but it’s not a big deal because it’s basically binary file read plus some simple search operations. Then the encoded packet is sent to GPU for decoding and that’s the time consuming process. Hence it’s offloaded to Nvdec. BTW please consider checking out https://github.com/RomanArzumanyan/VALI which is VPF spin off being actively developed and supported. It has compatible API and module naming. It’s basically a VPF replacement. |
I use the nvc.SeekContext(seek_ts=1.0), but it seems don't work on 30 fps video |
Hi @chenj133 I won't be able to replicate the behavior and potentially fix it on this repo. Last accepted commit was half a year ago... |
thanks,I'll try it some later |
Hi, I'm using the VALI project you recommended earlier, but it's not very convenient without a Dockerfile. I tried to reuse the Dockerfile from the vpf project, but it threw an error. I've included the specific file in the issue for that project.
result is(the real video duration second is 2035): the video file info is: |
I understand it now. I misdefined the parameter. The seek_ts in nvc.SeekContext represents the time to seek to, not the duration to seek. So I should write it like this
But after making this change, my efficiency dropped significantly. |
Random Access video operations like seek are costly. Decoder has to flush frames queue, reset it's internal state, and potentially reconfigure if key frame you seek for is IDR (Instant Decoder Refresh) frame. So your decoding performance may indeed degrade. However if you only need to take frame every second and your GOP size allows that, you can simply discard all other frames except I frames at demuxer level. Keep only I frames and feed them to decoder. Sometimes you may run into situation when it's better simply to decode everything and keep only those frames you need. |
I want to decode a frame each second.
the request is same with issue_232(#232)
the answer is a little old.
how can I find the seek func on master branch recently?
I find the seek_timestamp in tests/test_PyFfmpegDemuxer.py, but the output is on cpu,I don't want to decode to cpu,because I will send into tensorrt model.
how can I seek with timestamp now?
in opencv,it likes:
I retrieve CAP_PROP_POS_FRAMES and check CAP_PROP_POS_MSEC at the same time because some video CAP_PROP_POS_FRAMES is not right. for example, CAP_PROP_POS_FRAMES is 25,but the 25th frame's CAP_PROP_POS_MSEC is 0.83s
The text was updated successfully, but these errors were encountered: