Hi everyone !
I’m pretty new using Gstreamer and Jetson Boards.
I need to compress a lot of jpegs (150 images) into a video (h265 or mp4), and I would like to use HW acceleration. Beacsue Ffmpeg is not supported, I need to comply with Gstreamer and I have absolutely no idea of what I need to do…
Thank you by advance for your help !
Plugin multifilesrc is probably what you’re looking for.
What you need is to have all jpg files numbered continously. If it is not your case, you can make links to each image in a tmp directory with something like:
mkdir tmp
curIdx=0; for curFile in *.JPG; do outFile=`printf "./tmp/img_%04d.jpg" "$curIdx"`; echo 'File: '$curFile '->' $outFile; ln $curFile $outFile; curIdx=`expr $curIdx + 1 `; done
It should produce a tmp directory with links to found *.JPG files, named img_0000.jpg etc.
cd tmp
ls
img_0000.jpg img_0003.jpg img_0006.jpg img_0009.jpg
img_0001.jpg img_0004.jpg img_0007.jpg img_0010.jpg
img_0002.jpg img_0005.jpg img_0008.jpg img_0011.jpg
...
If you need more than 10000 images, you will have to modify the naming scheme.
Here are two examples that make a video from all jpeg pictures (img_XXXX.jpg), 1s per picture.
H264 and mp4mux:
gst-launch-1.0 multifilesrc location="img_%04d.jpg" index=0 caps="image/jpeg,framerate=1/1" ! jpegdec ! videoconvert ! videorate ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1920, height=1080' ! omxh264enc ! mp4mux ! filesink location=gatheredImages.mp4
H265 and matrsokamux:
gst-launch-1.0 multifilesrc location="img_%04d.jpg" index=0 caps="image/jpeg,framerate=1/1" ! jpegdec ! videoconvert ! videorate ! nvvidconv ! omxh265enc ! matroskamux ! filesink location=gatheredImages.mkv
Thank you so much for your answer, it really helped me !
I have another question now :
How can I easily manage output quality ?
I tried to adjust paramters such as control-rate or preste-level without any big differences…