string - Split GST Command using Shell Script -
i'd split next gst command 2 halves using shell script.
/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075
the split has occur @ caps = 2 new lines should stored in 2 variables $var1 , $var2
$var1 should contain /gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink:
and $var2 should contain application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075
remember there 2 backslashes in input string. doing echo give 1 backslash.
use shell parameter expansion:
$ cmd='/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075' $ first=${cmd% caps = *}; echo ">>$first<<" >>/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink:<< $ second=${cmd#* caps = }; echo ">>$second<<" >>application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075<<
string shell split gstreamer
No comments:
Post a Comment