Better command to reduce CPU use and format

Hello,

I have no idea or experience with this type of software. I’m launching a record with a camera directly from the command window with the next order:

gst-launch-1.0 udpsrc port=53260 !image/jpeg, framerate=30/1! jpegparse ! jpegdec ! jpegenc! avimux ! filesink location=C:/Temp/output.avi

I’m pretty sure that there are better ways to do it and formats to have a better use of the CPU.

Can someone help me to reduce this order and the CPU use to work the camera?

Thanks in advance!
Tomas

The two things that are CPU intensive in this pipeline are the jpegdec and the jpegenc.

You probably don’t really need that if you receive JPEG data already.

Does ... ! jpegparse ! avimux ! filesink location=... not work?

On a side note, it is 2024 and no one should be creating AVI files any more, I would suggest matroskamux min-index-interval=5000000000 if you don’t have any strong preferences (I’m not sure if the min-index-interval is required here, just making sure that it won’t create too many seek table entries, since JPEG is a keyframe only format).

The other thing that’s suboptimal with this pipeline is that you’re apparently just sending bits of raw JPEG data across the network.

If you have control over both the sender and the receiver I would suggest you use rtpjpegpay on the sender side and then rtpjpegdepay on the receiver side.

Hello,

Thanks for your help.

So, if i’m not wrong the sentence can be like this:

gst-launch-1.0 udpsrc port=53260 ! image/jpeg, framerate=30/1! jpegparse ! matroskamux min-index-interval=5000000000 ! filesink location=C:/Temp/output.avi
is that right?

even to reduce use of CPU, can i change ‘image/jpeg, framerate=30/1!’ and write ‘image/jpeg, framerate=15/1!’ for example?

thanks again for your help!
Tomas

Putting the framerate here in the caps shouldn’t really make any difference (although it might be written into the matroska header), what actually counts are the timestamps on the buffers.

The sender determines the framerate at which it sends the data.

If you want to change the framerate you can do that using the videorate element with e.g. ... ! videorate ! image/jpeg,framerate=5/1 ! ... which willl insert/drop frames and retimestamp them to match the target framerate.

This remaining pipeline shouldn’t use very much CPU in any case.