# How to convert YUV to JPG using jpeg encoder(hardware)

**URL:** <https://forums.developer.nvidia.com/t/how-to-convert-yuv-to-jpg-using-jpeg-encoder-hardware/47038>\
**Category:** Jetson TX1\
**Created:** [December 30, 2016, 10:40am UTC](https://forums.developer.nvidia.com/t/how-to-convert-yuv-to-jpg-using-jpeg-encoder-hardware/47038 "2016-12-30T10:40:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [January 4, 2017, 2:45am UTC](https://forums.developer.nvidia.com/t/how-to-convert-yuv-to-jpg-using-jpeg-encoder-hardware/47038/6 "2017-01-04T02:45:03Z")

</div>

Hi Allen,  
Please follow the steps to complete the JPEG encoding function.  
1 Run the command  
$ gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=300 ! ‘video/x-raw,width=1920,height=1080,format=(string)UYVY’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=(string)NV12’ ! nvoverlaysink  
With output format being set, it should work fine.  
2 Try the pre-release sample attached. You should see preview by running  
$ ./camera\_v4l2\_cuda -d /dev/video0 -s 1920x1080 -f UYVY -n 30  
3 Refer to 09\_camera\_jpeg\_capture and pass (Fd) to jpeg encoder. The flow is V4L2 camera → NvBuffer(fd) → jpeg encoder  
[tegra\_multimedia\_api\_sample\_pre\_release.tar.gz](https://forums.developer.nvidia.com/uploads/short-url/y5AdhjCXr50amBgCv4LwTK1P438.gz) (15 KB)

---

_[View the full topic](https://forums.developer.nvidia.com/t/how-to-convert-yuv-to-jpg-using-jpeg-encoder-hardware/47038)._
