Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: while input stream have stop , deffcode will not stop but just hold on #41

Open
3 tasks done
wuqingzhou828 opened this issue Aug 25, 2023 · 2 comments
Open
3 tasks done
Labels
Enhancement ⚡ New feature Issue/Request enhancing DeFFcode APIs. Needs Triage 🧐 Assign priority to this issue. Question ❔ Further information is requested related to DeFFcode APIs.

Comments

@wuqingzhou828
Copy link

Issue guidelines

Issue Checklist

  • I have searched open or closed issues for my problem and found nothing related or helpful.
  • I have read the Documentation and found nothing related to my problem.

Describe your Question

source: 'rtmp://xxxx/live/xxx' is a online stream
while the online stream haved close, my code will not stop but just hold on

Terminal log output(Optional)

No response

Python Code(Optional)

def test():
    ffparams = {
        "-vcodec": "h264_cuvid",
        "-debug": 1,
        "-ffprefixes": [
            "-vsync", "0",
            "-hwaccel_device", "0",
            "-hwaccel", "cuda",
        ],
        "-custom_resolution": "null",
        "-framerate": "null",
    }
    source = 'rtmp://xxxx/live/xxx'
    videoDecoder = VideoDecode(source=source, ffparams=ffparams)
    decoder = videoDecoder.decode(verbose=True)
    while True:
        try:
            frame = next(decoder.generateFrame(), None)
            if frame is None:
                break
        except Exception as e:
            print(e)

if __name__ == '__main__':
    test()

DeFFcode Version

0.2.5

Python version

3.8

Operating System version

nvcr.io/nvidia/tensorrt:22.04-py3 and ffmpeg gpu

Any other Relevant Information?

No response

@wuqingzhou828 wuqingzhou828 added the Question ❔ Further information is requested related to DeFFcode APIs. label Aug 25, 2023
@wuqingzhou828
Copy link
Author

i have to stop by KeyboardInterrupt
rtmp @ 0x555986dfd140] Sending bytes read report0:00:11.16 bitrate=1244160.0kbits/s speed= 1.8x
^CTraceback (most recent call last):1150kB time=00:00:20.88 bitrate=1244160.0kbits/s speed=1.34x
File "test_infer.py", line 120, in
test()
File "test_infer.py", line 110, in test
frame = next(decoder.generateFrame(), None)
File "/usr/local/lib/python3.8/dist-packages/deffcode/ffdecoder.py", line 711, in generateFrame
frame = self.__fetchNextFrame()
File "/usr/local/lib/python3.8/dist-packages/deffcode/ffdecoder.py", line 673, in __fetchNextFrame
frame = self.__fetchNextfromPipeline()
File "/usr/local/lib/python3.8/dist-packages/deffcode/ffdecoder.py", line 655, in __fetchNextfromPipeline
self.__process.stdout.read(
KeyboardInterrupt

@abhiTronix
Copy link
Owner

@wuqingzhou828 That is because you're processing frames in GPU memory which is separated from main thread and will continue to process until you manually kill the process or send SIGINT signal to terminate process. However I can add a flag to kill process immediately, I'll look into that,

@abhiTronix abhiTronix added Enhancement ⚡ New feature Issue/Request enhancing DeFFcode APIs. Needs Triage 🧐 Assign priority to this issue. labels Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ⚡ New feature Issue/Request enhancing DeFFcode APIs. Needs Triage 🧐 Assign priority to this issue. Question ❔ Further information is requested related to DeFFcode APIs.
Projects
None yet
Development

No branches or pull requests

2 participants