-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
Hi @rjhowell44
I encountered a bug when i try to set dimensions (640x360) for tap recording. The output video's dimention actual still same with original dimensions of rtsp stream (1920x1080). How can i fix it. below is my code to create a component:
def create_source_component(self, component):
retval = dsl_source_rtsp_new(
component.source_name, # source name
uri = component.source_uri, # using hikvision URI defined above
protocol = DSL_RTP_ALL, # use RTP ALL protocol
skip_frames = 0, # decode every frame
drop_frame_interval = 0, # decode every frame
latency = 1000, # 100 ms of jitter buffer
timeout = 10 # 2 second new buffer timeout
)
if (retval != DSL_RETURN_SUCCESS):
logger.error(f'[PGIE - ERROR] DSL Source RTSP New: {dsl_return_value_to_string(retval)}')
return retval
if DS_RTSP_STATE_CHANGE_LISTENER:
# Add the RTSP state-change listener calback to our RTSP Source
retval = dsl_source_rtsp_state_change_listener_add(component.source_name, self.rtsp_state_change_listener, None)
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Source RTSP State Change Listener Add: {dsl_return_value_to_string(retval)}')
return retval
# add video buffer out format
retval = dsl_source_video_buffer_out_format_set(component.source_name, DSL_VIDEO_FORMAT_RGBA)
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Source Video Buffer Out Format Set: {dsl_return_value_to_string(retval)}')
return retval
# set video buffer out size
retval = dsl_source_video_buffer_out_dimensions_set(component.source_name, STREAMUX_WIDTH, STREAMUX_HEIGHT)
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Source Video Buffer Out Size Set: {dsl_return_value_to_string(retval)}')
return retval
# set video buffer out fps
retval = dsl_source_video_buffer_out_frame_rate_set(component.source_name, 12, 1)
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Source Video Buffer Out FPS Set: {dsl_return_value_to_string(retval)}')
return retval
# ------------------------------------
# New record tap created with the record_event_listener callback function
# defined above - will be called on session-start and session-end
retval = dsl_tap_record_new(component.record_tap,
outdir = EVENT_SAVE_PATH,
container = DSL_CONTAINER_MP4,
client_listener = self.record_event_listener)
if (retval != DSL_RETURN_SUCCESS):
logger.error(f'[PGIE - ERROR] DSL Tap Record New: {dsl_return_value_to_string(retval)}')
return retval
# Set recording config
retval = dsl_tap_record_dimensions_set(component.record_tap, RECORDING_WIDTH, RECORDING_HEIGHT)
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Tap Record Dimensions Set: {dsl_return_value_to_string(retval)}')
return retval
# IMPORTANT: Best to set the max-size to the maximum value we
# intend to use (see the xwindow_key_event_handler callback above).
retval = dsl_tap_record_max_size_set(component.record_tap, int((RECORDING_START + RECORDING_DURATION) * (1 + SAFE_BUFFER)))
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Tap Record Max Size Set: {dsl_return_value_to_string(retval)}')
return retval
# IMPORTANT: Best to set the default cache-size to the maximum value we
# intend to use (see the xwindow_key_event_handler callback above).
retval = dsl_tap_record_cache_size_set(component.record_tap, int(RECORDING_START * (1 + SAFE_BUFFER)))
if retval != DSL_RETURN_SUCCESS:
logger.error(f'[PGIE - ERROR] DSL Tap Record Cache Size Set: {dsl_return_value_to_string(retval)}')
return retval
# Add the new Tap to the Source directly
retval = dsl_source_rtsp_tap_add(component.source_name, component.record_tap)
if (retval != DSL_RETURN_SUCCESS):
logger.error(f'[PGIE - ERROR] DSL Tap Record Tap Add: {dsl_return_value_to_string(retval)}')
return retval
# Add the new Source with its Record-Tap to the Pipeline
retval = dsl_pipeline_component_add('pipeline', component.source_name)
if (retval != DSL_RETURN_SUCCESS):
logger.error(f'[PGIE - ERROR] DSL Pipeline Component Add: {dsl_return_value_to_string(retval)}')
return retval
Metadata
Metadata
Assignees
Labels
No labels