Record and Play 4K@30fps .mp4 with USB Camera

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

Record and Play 4K@30fps .mp4 with USB Camera

259 Views
Derek0902
Contributor II

Hi,

The USB Camera format is below:

 

Derek0902_0-1706678136526.pngDerek0902_1-1706678142057.png

Use V4L2 to record 4K@30fps .mp4 file :

 

v4l2-ctl --device /dev/video4 --set-fmt-video=width=3840,height=2160,pixelformat=MJPG --stream-mmap --stream-to=./output4K.mp4 --stream-count=300

 

 

Use Gstreamer to play .mp4 file :

 

gst-launch-1.0 filesrc location=/home/root/output4K.mp4 ! jpegdec ! autovideosink

 

 

The video only have 8.6 fps:

Derek0902_2-1706678384358.png

On my ubuntu PC:

The video play smoothly, but only take 5 sec to finish.

The video time should be 300 frame / 30fps = 10 sec. 

 

Regards,

Derek Lin

 

0 Kudos
2 Replies

247 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

It is weird, but the i.mx8 is able to decode mp4 videos but you have to see the usb, is transfer the data ok? which usb are you using 2.0 or 3.0?

Regards

0 Kudos

243 Views
Derek0902
Contributor II

Hi @Bio_TICFSL ,

The camera interface is USB 2.0 . 

If I use Gstreamer to stream and display camera preview, the fps  will be lower than 5 and appear computer too slow. Then the CPU usage is over than 100%. Here is my command:

 

gst-launch-1.0 v4l2src device=/dev/video4 ! image/jpeg,width=3840,height=2160,framerate=30/1 ! jpegdec ! autovideosink

 

 

If  camera resolution is modified to 640x360, the fps will be correct.

Regards,

Derek Lin

0 Kudos