GStreamer Transcoding and Scaling

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GStreamer Transcoding and Scaling

GStreamer Transcoding and Scaling

Audio transcoding

# Transcode the input file into MP3

gst-launch filesrc location=media_file typefind=true ! beepdec ! mfw_mp3encoder ! matroskamux ! filesink location=output_audio_file.mk

Audio transcoding + streaming

# Transcode the input file into MP3 and stream it

# On host, get the transcoded audio data

gst-launch udpsrc port=8880 ! <CAPS_FROM_THE_TARGET> ! queue ! ffdec_mp3 ! alsasink

# where <CAPS_FROM_THE_TARGET> can be something like 'audio/mpeg, mpegversion=(int)1, layer=(int)3, rate=(int)44100, channels=(int)2'

# run the pipeline and check the caps

gst-launch filesrc location=media_file typefind=true ! queue ! beepdec ! mfw_mp3encoder ! udpsink host=10.112.103.77 port=8880 -v

Video Transcoding*

# Transcode the input file into AVC (H-264)

gst-launch filesrc location=media_file typefind=true ! aiurdemux name=demux ! queue ! vpudec ! vpuenc codec=avc ! matroskamux name=mux ! filesink location=output_media_file.mk

Video Transcoding + scaling*

# Transcode the input file into AVC (H264) and rescale video to 480p

gst-launch filesrc location=media_file typefind=true ! aiurdemux name=demux ! queue ! vpudec ! mfw_ipucsc ! 'video/x-raw-yuv, width=(int)720, height=(int)480' ! vpuenc codec=avc ! matroskamux name=mux ! filesink location=output_media_file.mk

Video transcoding + scaling + streaming*

# NOTE: Run the pipelines in the presented order

# On host, get the transcoded+scaled video data

$ gst-launch udpsrc port=8888 ! <CAPS_FROM_THE_TARGET> ! queue ! ffdec_h264 ! xvimagesink

# On target, run the pipeline and check the caps

gst-launch filesrc location=media_file typefind=true ! aiurdemux name=demux ! queue ! vpudec ! mfw_ipucsc ! 'video/x-raw-yuv, width=(int)720, height=(int)480' ! vpuenc codec=avc ! udpsink host=$HOST_IP port=8888 -v

* There is a limit for the number of pipelines which can be run simultaneously, for high resolution input files, at most two for 1080p and four for 720p.

Labels (2)
%3CLINGO-SUB%20id%3D%22lingo-sub-1106528%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EGStreamer%20Transcoding%20and%20Scaling%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1106528%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CTABLE%20border%3D%221%22%20class%3D%22jiveBorder%22%20style%3D%22border%3A%201px%20solid%20%23000000%3B%20width%3A%20100%25%3B%22%3E%3CTBODY%3E%3CTR%3E%3CTH%20style%3D%22text-align%3A%20center%3B%20background-color%3A%20%236690bc%3B%20color%3A%20%23ffffff%3B%20padding%3A%202px%3B%22%20valign%3D%22middle%22%3E%3C%2FTH%3E%3CTH%20style%3D%22text-align%3A%20center%3B%20background-color%3A%20%236690bc%3B%20color%3A%20%23ffffff%3B%20padding%3A%202px%3B%22%20valign%3D%22middle%22%3E%3C%2FTH%3E%3C%2FTR%3E%3CTR%3E%3CTD%20colspan%3D%221%22%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3EAudio%20transcoding%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%3CTD%20colspan%3D%221%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20Transcode%20the%20input%20file%20into%20MP3%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20filesrc%20location%3Dmedia_file%20typefind%3Dtrue%20!%20beepdec%20!%20mfw_mp3encoder%20!%20matroskamux%20!%20filesink%20location%3Doutput_audio_file.mk%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3EAudio%20transcoding%20%2B%20streaming%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%3CTD%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20Transcode%20the%20input%20file%20into%20MP3%20and%20stream%20it%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20On%20host%2C%20get%20the%20transcoded%20audio%20data%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20udpsrc%20port%3D8880%20!%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%3CCAPS_FROM_THE_TARGET%3E%3C%2FCAPS_FROM_THE_TARGET%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%20!%20queue%20!%20ffdec_mp3%20!%20alsasink%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%23%3C%2FSPAN%3E%3CSTRONG%3E%20%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FSTRONG%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%3CCAPS_FROM_THE_TARGET%3E%3C%2FCAPS_FROM_THE_TARGET%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%20can%20be%20something%20like%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E'audio%2Fmpeg%2C%20mpegversion%3D(int)1%2C%20layer%3D(int)3%2C%20rate%3D(int)44100%2C%20channels%3D(int)2'%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Erun%20the%20pipeline%20and%20check%20the%20caps%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20filesrc%20location%3Dmedia_file%20typefind%3Dtrue%20!%20queue%20!%20beepdec%20!%20mfw_mp3encoder%20!%20udpsink%20host%3D10.112.103.77%20port%3D8880%20-v%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3EVideo%20Transcoding*%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20Transcode%20the%20input%20file%20into%20AVC%20(H-264)%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20filesrc%20location%3Dmedia_file%20typefind%3Dtrue%20!%20aiurdemux%20name%3Ddemux%20!%20queue%20!%20vpudec%20!%20vpuenc%20codec%3D%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3Eavc%3C%2FSPAN%3E%20!%20matroskamux%20name%3Dmux%20!%20filesink%20location%3Doutput_media_file.mk%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3EVideo%20Transcoding%20%2B%20scaling*%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20Transcode%20the%20input%20file%20into%20AVC%20(H264)%20and%20rescale%20video%20to%20480p%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20filesrc%20location%3Dmedia_file%20typefind%3Dtrue%20!%20aiurdemux%20name%3Ddemux%20!%20queue%20!%20vpudec%20!%20mfw_ipucsc%20!%20'video%2Fx-raw-yuv%2C%20width%3D(int)%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3E720%3C%2FSPAN%3E%2C%20height%3D(int)%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3E480%3C%2FSPAN%3E'%20!%20vpuenc%20codec%3D%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3Eavc%3C%2FSPAN%3E%20!%20matroskamux%20name%3Dmux%20!%20filesink%20location%3Doutput_media_file.mk%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3EVideo%20transcoding%20%2B%20scaling%20%2B%20streaming*%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%3CTD%20style%3D%22padding%3A%202px%3B%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20NOTE%3A%20Run%20the%20pipelines%20in%20the%20presented%20order%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20On%20host%2C%20get%20the%20transcoded%2Bscaled%20video%20data%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%24%20gst-launch%20udpsrc%20port%3D8888%20!%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%3CCAPS_FROM_THE_TARGET%3E%3C%2FCAPS_FROM_THE_TARGET%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%20!%20queue%20!%20ffdec_h264%20!%20xvimagesink%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3E%23%20On%20target%2C%20run%20the%20pipeline%20and%20check%20the%20caps%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSTRONG%3Egst-launch%20filesrc%20location%3Dmedia_file%20typefind%3Dtrue%20!%20aiurdemux%20name%3Ddemux%20!%20queue%20!%20vpudec%20!%20mfw_ipucsc%20!%20'video%2Fx-raw-yuv%2C%20width%3D(int)%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3E720%3C%2FSPAN%3E%2C%20height%3D(int)%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3E480%3C%2FSPAN%3E'%20!%20vpuenc%20codec%3D%3CSPAN%20style%3D%22font-size%3A%2012pt%3B%22%3Eavc%3C%2FSPAN%3E%20!%20udpsink%20host%3D%24HOST_IP%20port%3D8888%20-v%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000080%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22font-size%3A%2014pt%3B%22%3E*%3C%2FSPAN%3E%20There%20is%20a%20limit%20for%20the%20number%20of%20pipelines%20which%20can%20be%20run%20simultaneously%2C%20for%20high%20resolution%20input%20files%2C%20at%20most%20two%20for%201080p%20and%20four%20for%20720p.%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1106528%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MX6_All%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMultimedia%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
No ratings
Version history
Last update:
‎09-28-2012 01:07 PM
Updated by: