GstCUDA - Example - cudamux: Unified memory allocator

From RidgeRun Developer Wiki


Previous: Example - cudamux: NVMM direct mapping Index Next: Example 2: cudadebayer





This page gives a set of test pipelines to use cudafilter element for Unified memory allocator mode.

Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help.


The perf element can be downloaded from this repository, otherwise the element can be removed from the pipeline without any issues.

Mixer CUDA library algorithm

For these examples, remember to be in the correct path to use the binaries:

cd $GstCUDA_DIR/tests/examples/cudamux_algorithms/mixer/

2x 720p 30fps videotestsrc sources mixed to display (in-place=true)

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=true location=./mixer.so videotestsrc pattern=ball is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_0 videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 2:17:05.520248785; Bps: 0; fps: 0.0; CPU: 7;  
GST-PERF INFO -->  Timestamp: 2:17:06.552392216; Bps: 1339534; fps: 30.3; CPU: 18;  
GST-PERF INFO -->  Timestamp: 2:17:07.552500402; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:08.585805104; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:09.585811091; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:10.619149852; Bps: 1338238; fps: 30.0; CPU: 20;  
GST-PERF INFO -->  Timestamp: 2:17:11.652410906; Bps: 1338238; fps: 30.0; CPU: 18;  
GST-PERF INFO -->  Timestamp: 2:17:12.685735851; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:13.719148494; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:14.752435079; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:17:15.752453087; Bps: 1382400; fps: 30.0; CPU: 17;

Example pipeline for x86

gst-launch-1.0 cudamux name=cuda in-place=true location=./mixer.so videotestsrc pattern=ball is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_0 videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! autovideosink

Performance stats

INFO:
perf: perf0; timestamp: 8:45:52.844381076; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,037; mean_fps: 29,809; cpu: 16; 
INFO:
perf: perf0; timestamp: 8:45:53.876643354; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,031; mean_fps: 29,883; cpu: 18; 
INFO:
perf: perf0; timestamp: 8:45:54.877448218; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,976; mean_fps: 29,906; cpu: 19; 
INFO:
perf: perf0; timestamp: 8:45:55.879699874; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,933; mean_fps: 29,911; cpu: 18; 
INFO:
perf: perf0; timestamp: 8:45:56.912606380; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,012; mean_fps: 29,928; cpu: 16; 
INFO:
perf: perf0; timestamp: 8:45:57.914324351; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,949; mean_fps: 29,931; cpu: 16; 
INFO:
perf: perf0; timestamp: 8:45:58.946700336; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,028; mean_fps: 29,943; cpu: 18; 
INFO:
perf: perf0; timestamp: 8:45:59.978041691; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,058; mean_fps: 29,956; cpu: 16; 
INFO:
perf: perf0; timestamp: 8:46:00.980825922; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,917; mean_fps: 29,952; cpu: 18; 
INFO:
perf: perf0; timestamp: 8:46:02.010964952; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,093; mean_fps: 29,965; cpu: 14;

2x 720p 30fps videotestsrc sources mixed to display (in-place=false)

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=false location=./mixer.so videotestsrc pattern=ball is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_0 videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 2:26:14.215196463; Bps: 0; fps: 0.0; CPU: 7;  
GST-PERF INFO -->  Timestamp: 2:26:15.245993116; Bps: 1342135; fps: 30.9; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:16.279247711; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:17.279251043; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:18.312575828; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:19.312651365; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:20.312652188; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:21.312674426; Bps: 1382400; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:22.345924679; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:23.379330170; Bps: 1338238; fps: 30.0; CPU: 17;  
GST-PERF INFO -->  Timestamp: 2:26:24.412584052; Bps: 1338238; fps: 30.0; CPU: 17;

Example pipeline for x86

gst-launch-1.0 cudamux name=cuda in-place=false location=./mixer.so videotestsrc pattern=ball is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_0 videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,format=I420,framerate=30/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! autovideosink

Performance stats

INFO:
perf: perf0; timestamp: 9:06:15.627757620; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,144; mean_fps: 29,763; cpu: 16; 
INFO:
perf: perf0; timestamp: 9:06:16.632249041; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,866; mean_fps: 29,797; cpu: 19; 
INFO:
perf: perf0; timestamp: 9:06:17.663080262; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,073; mean_fps: 29,866; cpu: 16; 
INFO:
perf: perf0; timestamp: 9:06:18.695324102; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,032; mean_fps: 29,899; cpu: 15; 
INFO:
perf: perf0; timestamp: 9:06:19.697815513; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,925; mean_fps: 29,904; cpu: 18; 
INFO:
perf: perf0; timestamp: 9:06:20.728321312; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,082; mean_fps: 29,929; cpu: 16; 
INFO:
perf: perf0; timestamp: 9:06:21.728452839; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,996; mean_fps: 29,937; cpu: 16; 
INFO:
perf: perf0; timestamp: 9:06:22.761023304; bps: 331776000,000; mean_bps: 331776000,000; fps: 30,022; mean_fps: 29,947; cpu: 15; 
INFO:
perf: perf0; timestamp: 9:06:23.761465712; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,987; mean_fps: 29,951; cpu: 16; 
INFO:
perf: perf0; timestamp: 9:06:24.762143903; bps: 331776000,000; mean_bps: 331776000,000; fps: 29,980; mean_fps: 29,953; cpu: 16;

2x 1080p 60fps camera streams mixed to display (in-place=true)

Note: We only use one camera source that is split into two sources by a tee element. One of the video source input branches is flipped by 180 degrees, so the resultant image is a combination of the input image with the same image rotated.

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=true location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=1920,height=1080,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=1920,height=1080,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:54:09.890542421; Bps: 3079603; fps: 62.37; CPU: 35;  
GST-PERF INFO -->  Timestamp: 0:54:10.892070782; Bps: 3107292; fps: 60.93; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:54:11.896396470; Bps: 3098007; fps: 61.75; CPU: 43;  
GST-PERF INFO -->  Timestamp: 0:54:12.906586539; Bps: 3079603; fps: 60.39; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:54:13.906985138; Bps: 3110400; fps: 61.0; CPU: 31;  
GST-PERF INFO -->  Timestamp: 0:54:14.907264790; Bps: 3110400; fps: 61.0; CPU: 31;  
GST-PERF INFO -->  Timestamp: 0:54:15.923716578; Bps: 3061417; fps: 61.2; CPU: 29;  
GST-PERF INFO -->  Timestamp: 0:54:16.923874946; Bps: 3110400; fps: 60.0; CPU: 28;  
GST-PERF INFO -->  Timestamp: 0:54:17.940241417; Bps: 3061417; fps: 61.2; CPU: 29;  
GST-PERF INFO -->  Timestamp: 0:54:18.956410638; Bps: 3061417; fps: 61.2; CPU: 29;


2x 1080p 60fps camera streams mixed to display (in-place=false)

Note: We only use one camera source that is split into two sources by a tee element. One of the video source input branches is flipped by 180 degrees, so the resultant image is a combination of the input image with the same image rotated.

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=false location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=1920,height=1080,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=1920,height=1080,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! nvvidconv ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:00:46.383580704; Bps: 803; fps: 59.70; CPU: 43;  
GST-PERF INFO -->  Timestamp: 0:00:47.398781920; Bps: 796; fps: 60.9; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:00:48.399392928; Bps: 808; fps: 60.0; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:00:49.399527648; Bps: 808; fps: 60.0; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:00:50.400363648; Bps: 808; fps: 60.0; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:00:51.415446208; Bps: 796; fps: 60.9; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:00:52.416488224; Bps: 807; fps: 59.94; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:00:53.431558976; Bps: 796; fps: 60.9; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:00:54.432043168; Bps: 808; fps: 60.0; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:00:55.432713696; Bps: 808; fps: 60.0; CPU: 38;

2x 4K 60fps camera streams camera streams mixed to display (in-place=true)

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=true location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=3840,height=2160,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:02:38.810489797; Bps: 12281934; fps: 54.29; CPU: 43;  
GST-PERF INFO -->  Timestamp: 0:02:39.821709143; Bps: 12306231; fps: 59.34; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:02:40.828061880; Bps: 12367395; fps: 57.65; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:02:41.832679729; Bps: 12392031; fps: 56.77; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:02:42.843748886; Bps: 12306231; fps: 57.36; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:02:43.849270325; Bps: 12379701; fps: 57.71; CPU: 38;  
GST-PERF INFO -->  Timestamp: 0:02:44.871236730; Bps: 12185700; fps: 55.82; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:02:45.879539438; Bps: 12342857; fps: 57.53; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:02:46.886737899; Bps: 12355114; fps: 57.59; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:02:47.908685488; Bps: 12185700; fps: 57.78; CPU: 38;

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=true location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=3840,height=2160,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! fakesink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:09:38.801315027; Bps: 12342857; fps: 57.53; CPU: 35;  
GST-PERF INFO -->  Timestamp: 0:09:39.815133433; Bps: 12281934; fps: 60.21; CPU: 33;  
GST-PERF INFO -->  Timestamp: 0:09:40.829399126; Bps: 12269822; fps: 60.15; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:09:41.843304048; Bps: 12281934; fps: 60.21; CPU: 31;  
GST-PERF INFO -->  Timestamp: 0:09:42.856993831; Bps: 12281934; fps: 60.21; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:09:43.870808115; Bps: 12281934; fps: 60.21; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:09:44.884989296; Bps: 12269822; fps: 60.15; CPU: 31;  
GST-PERF INFO -->  Timestamp: 0:09:45.898407691; Bps: 12281934; fps: 60.21; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:09:46.912270542; Bps: 12281934; fps: 60.21; CPU: 32;  
GST-PERF INFO -->  Timestamp: 0:09:47.925801226; Bps: 12281934; fps: 60.21; CPU: 31;


2x 4K 60fps camera streams mixed to fakesink (in-place=false)

Note: Due to limitations of the nvoverlaysink element, we use a fakesink instead to demonstrate that cudamux is capable to handle up to 2x4K@60fps streams.

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=false location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=3840,height=2160,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! nvoverlaysink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:04:14.971926407; Bps: 12330624; fps: 29.73; CPU: 46;  
GST-PERF INFO -->  Timestamp: 0:04:16.004288294; Bps: 12055813; fps: 30.3; CPU: 42;  
GST-PERF INFO -->  Timestamp: 0:04:17.005483774; Bps: 12429170; fps: 29.97; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:04:18.008205460; Bps: 12416766; fps: 29.94; CPU: 42;  
GST-PERF INFO -->  Timestamp: 0:04:19.038957416; Bps: 12079223; fps: 30.9; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:04:20.039518210; Bps: 12441600; fps: 30.0; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:04:21.041358050; Bps: 12429170; fps: 29.97; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:04:22.073649949; Bps: 12055813; fps: 30.3; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:04:23.104524511; Bps: 12079223; fps: 30.9; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:04:24.105627656; Bps: 12429170; fps: 29.97; CPU: 42;

Example pipeline

gst-launch-1.0 cudamux name=cuda in-place=false location=./mixer.so nvcamerasrc queue-size=10 sensor-id=0 fpsRange='60 60' ! "video/x-raw(memory:NVMM),width=3840,height=2160,format=I420,framerate=60/1" ! tee name=t t.src_0 ! nvvidconv ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_0 t.src_1 ! nvvidconv flip-method=2 ! "video/x-raw,width=3840,height=2160,format=I420,framerate=60/1" ! queue ! cuda.sink_1 cuda. ! perf print-arm-load=true ! fakesink --gst-debug=3

Performance stats

GST-PERF INFO -->  Timestamp: 0:05:41.050013247; Bps: 12281934; fps: 55.28; CPU: 43;  
GST-PERF INFO -->  Timestamp: 0:05:42.068405523; Bps: 12221611; fps: 56.97; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:05:43.073079219; Bps: 12392031; fps: 57.76; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:05:44.090560802; Bps: 12233628; fps: 57.3; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:05:45.101592523; Bps: 12306231; fps: 57.36; CPU: 42;  
GST-PERF INFO -->  Timestamp: 0:05:46.109970722; Bps: 12342857; fps: 56.54; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:05:47.111122977; Bps: 12429170; fps: 56.94; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:05:48.115134134; Bps: 12392031; fps: 52.78; CPU: 41;  
GST-PERF INFO -->  Timestamp: 0:05:49.124733158; Bps: 12330624; fps: 50.54; CPU: 39;  
GST-PERF INFO -->  Timestamp: 0:05:50.136217658; Bps: 12306231; fps: 50.44; CPU: 37;  
GST-PERF INFO -->  Timestamp: 0:05:51.140466146; Bps: 12392031; fps: 49.80; CPU: 37;  
GST-PERF INFO -->  Timestamp: 0:05:52.145298933; Bps: 12392031; fps: 49.80; CPU: 40;  
GST-PERF INFO -->  Timestamp: 0:05:53.151015233; Bps: 12379701; fps: 49.75; CPU: 40;


Previous: Example - cudamux: NVMM direct mapping Index Next: Example 2: cudadebayer