I am actually working on video streaming, the goal is to take RTSP Stream from camera and convert it to FLV file. Here is what I have tried :
$GSTREAMER rtspsrc location=$RTSP_SOURCE ! rtpbin ! rtph264depay ! h264parse \
! avdec_h264 ! video-x/raw,width=500,height=500 ! x264enc ! h264parse ! flvmux ! filesink location=$FLV_SINK
The pipeline shows an error saying that it cannot use avdec_h264
with x264enc
, is there any alternative to avdec_h264 or x264enc that can be used together ? or is there any alternative way to do the same.
Remove video-x/raw,width=500,height=500
. You cannot dictate the video resolution like that without a video scale element.
If scaling is desired add a videoscale
element. Make sure your output dimensions are compatible with the codec and the element will handle.
Select width and height that is a multiple of 16 to be on the safe side.
$GSTREAMER rtspsrc location=$RTSP_SOURCE ! rtpbin ! rtph264depay ! h264parse \
! avdec_h264 ! videoscale ! video-x/raw,width=640,height=640 ! x264enc ! h264parse ! flvmux ! filesink location=$FLV_SINK