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

Python: more than one stream? #7

Closed
cesarandreslopez opened this issue Jun 30, 2020 · 3 comments
Closed

Python: more than one stream? #7

cesarandreslopez opened this issue Jun 30, 2020 · 3 comments

Comments

@cesarandreslopez
Copy link

This is a very helpful implementation, thank you very much. I've gotten it to work well from Opencv to RTMP via Python using one stream.

My issue is when I try to open a second something like this:

    sc_clean = StreamerConfig()
    sc_clean.source_width = frame.shape[1]
    sc_clean.source_height = frame.shape[0]
    sc_clean.stream_width = frame.shape[1]
    sc_clean.stream_height = frame.shape[0]
    sc_clean.stream_fps = 25
    sc_clean.stream_bitrate = 3500000
    sc_clean.stream_profile = 'main' #'high444' # 'main'
    sc_clean.stream_server = 'rtmp://localhost:1935/app/clean'
    streamer_clean = Streamer()
    streamer_clean.init(sc_clean)
    streamer_clean.enable_av_debug_log()

    sc_cooked = StreamerConfig()
    sc_cooked.source_width = frame.shape[1]
    sc_cooked.source_height = frame.shape[0]
    sc_cooked.stream_width = frame.shape[1]
    sc_cooked.stream_height = frame.shape[0]
    sc_cooked.stream_fps = 25
    sc_cooked.stream_bitrate = 3500000
    sc_cooked.stream_profile = 'main' #'high444' # 'main'
    sc_cooked.stream_server = 'rtmp://localhost:1935/app/cooked'
    streamer_cooked = Streamer()
    streamer_cooked.init(sc_cooked)
    streamer_cooked.enable_av_debug_log()
   

   while (True):
        clean_frame = frame.copy()
        frame = some_process(frame) #some processing is done on the frame in opencv
        now = time.time()
        duration = now - prev
        streamer_clean.stream_frame_with_duration(frame, int(duration*1000))
        streamer_cooked.stream_frame_with_duration(clean_frame, int(duration*1000))
        prev = now

Running the above will still run, but the first RTMP stream itself will seem garbled like if it were combining and streaming a mix of both streamer data into one and the second RTMP stream won't work at all.

Is there anyway that I can open up more than one Streaming object in python?

@cesarandreslopez
Copy link
Author

Nevermind! This is actually a problem with OvenMediaEngine (https://github.com/AirenSoft/OvenMediaEngine), which was the receiving rtmp sever. The example above is solved when a different RTMP server is used.

@beyond21299
Copy link

I didn't get an error from cmake,also no error from make.
The examples given in the project also work.But I don't konw hwot to use this by python. Can you teach me how to use this by python?

@beyond21299
Copy link

This is a very helpful implementation, thank you very much. I've gotten it to work well from Opencv to RTMP via Python using one stream.

My issue is when I try to open a second something like this:

    sc_clean = StreamerConfig()
    sc_clean.source_width = frame.shape[1]
    sc_clean.source_height = frame.shape[0]
    sc_clean.stream_width = frame.shape[1]
    sc_clean.stream_height = frame.shape[0]
    sc_clean.stream_fps = 25
    sc_clean.stream_bitrate = 3500000
    sc_clean.stream_profile = 'main' #'high444' # 'main'
    sc_clean.stream_server = 'rtmp://localhost:1935/app/clean'
    streamer_clean = Streamer()
    streamer_clean.init(sc_clean)
    streamer_clean.enable_av_debug_log()

    sc_cooked = StreamerConfig()
    sc_cooked.source_width = frame.shape[1]
    sc_cooked.source_height = frame.shape[0]
    sc_cooked.stream_width = frame.shape[1]
    sc_cooked.stream_height = frame.shape[0]
    sc_cooked.stream_fps = 25
    sc_cooked.stream_bitrate = 3500000
    sc_cooked.stream_profile = 'main' #'high444' # 'main'
    sc_cooked.stream_server = 'rtmp://localhost:1935/app/cooked'
    streamer_cooked = Streamer()
    streamer_cooked.init(sc_cooked)
    streamer_cooked.enable_av_debug_log()
   

   while (True):
        clean_frame = frame.copy()
        frame = some_process(frame) #some processing is done on the frame in opencv
        now = time.time()
        duration = now - prev
        streamer_clean.stream_frame_with_duration(frame, int(duration*1000))
        streamer_cooked.stream_frame_with_duration(clean_frame, int(duration*1000))
        prev = now

Running the above will still run, but the first RTMP stream itself will seem garbled like if it were combining and streaming a mix of both streamer data into one and the second RTMP stream won't work at all.

Is there anyway that I can open up more than one Streaming object in python?

I didn't get an error from cmake,also no error from make.
The examples given in the project also work.But I don't konw hwot to use this by python. Can you teach me how to use this by python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants