This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: JPEG decode and display

Part Number: AM5728

Tool/software: Linux

Hi,

In Processr-SDK-linux-AM57xx environment, please tell me a simple way to display JPEG file on LCD or HDMI display.

Best Regards,
Shigehiro Tsuda

  • Hello,

    You could refer the below guide:
    software-dl.ti.com/.../Foundational_Components_Multimedia.html
    As you could see there is gstreamer ducatijpegdec/ducatijpegdecvpe element for image decoding.
    Hope this helps.

    BR
    Margarita

  • Hi Margarita,

    Thank you for quick reply.

    What is the command to display Jpeg file using gstreamer when using waylandsink?
    Please tell me which command you can check.
    I am executing the following command, but I am having trouble with an error.

    gst-launch-1.0 filesrc location=***.jpeg ! ducatijpegdec ! vpe ! 'video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720' ! waylandsink

    Best Regards,
    Shigehiro Tsuda

  • Hello,

    Please add jpegparse element between decoder and filesrc.
    If there is an error again please add --gst-debug=2 and share the log.
    Thank you!

    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.
    I added jpegparse and confirmed it, but an error occurred.
    The log is below.

    root@am57xx-evm:~# gst-launch-1.0 --gst-debug=2 filesrc location=test.jpeg ! jpegparse ! ducatijpegdec ! vpe ! 'video/x-raw, format=(
    string)NV12, width=(int)720, height=(int)480' ! waylandsink
    Setting pipeline to PAUSED ...
    [ 5844.332514] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    0:00:00.148980706 2217 0x175320 WARN basesrc gstbasesrc.c:3480:gst_base_src_start_complete:<filesrc0> pad not activated yet
    Pipeline is PREROLLING ...
    0:00:00.150712130 2217 0x164120 WARN jpegparse gstjpegparse.c:705:gst_jpeg_parse_read_header:<jpegparse0> unhandled marker c2, leaving
    0:00:00.151059912 2217 0x164120 WARN baseparse gstbaseparse.c:3597:gst_base_parse_loop:<jpegparse0> error: Internal data stream error.
    0:00:00.151099765 2217 0x164120 WARN baseparse gstbaseparse.c:3597:gst_base_parse_loop:<jpegparse0> error: streaming stopped, reason not-negotiated (-4)
    ERROR: from element /GstPipeline:pipeline0/GstJpegParse:jpegparse0: Internal data stream error.
    Additional debug info:
    ../../../../gstreamer-1.12.2/libs/gst/base/gstbaseparse.c(3597): gst_base_parse_loop (): /GstPipeline:pipeline0/GstJpegParse:jpegparse0:
    streaming stopped, reason not-negotiated (-4)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    Freeing pipeline ...

    Best Regards,
    Shigehiro Tsuda
  • Hello Shigehiro Tsuda,

    Let me check on my side. I will get back to you with the answer after <1 hour.

    BR
    Margarita
  • Hello Shigehiro Tsuda,


    1.Use case jpegenc->jpegdecode->display.
    gst-launch-1.0 -v -e videotestsrc ! video/x-raw, format=NV12, width=1280, height=720, framerate=30/1 ! queue ! ducatijpegenc ! jpegparse ! queue ! ducatijpegdec ! vpe ! video/x-raw, width=800, height=480 ! waylandsink sync=false use-drm=true

    2. First Pipeline is used to encode 50 frames. Second pipeline is decoding and display these 50 frames.
    gst-launch-1.0 -e videotestsrc num-buffers=50 ! 'video/x-raw,format=(string)YUY2,width=1280,height=720,framerate=(fraction)30/1' ! vpe ! ducatijpegenc ! jpegparse ! filesink location=jpegenc.jpeg
    gst-launch-1.0 filesrc location=jpegenc.jpeg ! jpegparse ! queue ! ducatijpegdec ! vpe ! video/x-raw, width=800, height=480 ! waylandsink sync=false use-drm=true

    3. First pipeline is encoding 1 frame. The specific in the second pipeline which is decode->display is that I have added imagefreeze element since the frame is displayed so fast almost impossible to see it.

    The imagefreeze element generates a still frame video stream from the input. It duplicates the first frame with the framerate requested by downstream, allows seeking and answers queries.

    gst-launch-1.0 -e videotestsrc num-buffers=1 ! 'video/x-raw,format=(string)YUY2,width=1280,height=720,framerate=(fraction)30/1' ! vpe ! ducatijpegenc ! jpegparse ! filesink location=jpegenc_1frame.jpeg

    gst-launch-1.0 filesrc location=jpegenc_1frame.jpeg ! jpegparse ! queue ! ducatijpegdec ! vpe ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink sync=false use-drm=true

    If you want you could remove sync=false in all cases.
    I have tested this on PSDK 4.3 and 5.0. Note the different between PSDK 4.x and 5.x is the gstreamer version in first case is 1.8 in second 1.12.

    Hope this helps.

    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.
    I checked 1 to 3 of your answers.
    The color bar was displayed normally on the display.
    However, it seems that an error has occurred in the normal jpeg file as follows.
    The encoded JPEG file is OK, but it seems that an error occurs in a normal JPEG file.

    root@am57xx-evm:~/image# gst-launch-1.0 --gst-debug=2 filesrc location=test.jpeg ! jpegparse ! queue ! ducatijpegdec ! vpe ! video/x
    -raw, width=800, height=480 ! imagefreeze ! waylandsink sync=false use-drm=true
    Setting pipeline to PAUSED ...
    [17013.792300] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    0:00:00.149052605 2471 0x17ada0 WARN filesrc gstfilesrc.c:535:gst_file_src_start:<filesrc0> error: No such file "test.jpeg"
    0:00:00.149208765 2471 0x17ada0 WARN basesrc gstbasesrc.c:3345:gst_base_src_start:<filesrc0> error: Failed to start
    0:00:00.149372408 2471 0x17ada0 WARN filesrc gstfilesrc.c:535:gst_file_src_start:<filesrc0> error: No such file "test.jpeg"
    0:00:00.149448699 2471 0x17ada0 WARN basesrc gstbasesrc.c:3345:gst_base_src_start:<filesrc0> error: Failed to start
    0:00:00.149517019 2471 0x17ada0 WARN basesrc gstbasesrc.c:3718:gst_base_src_activate_push:<filesrc0> Failed to start in push mode
    0:00:00.149550040 2471 0x17ada0 WARN GST_PADS gstpad.c:1107:gst_pad_set_active:<filesrc0:src> Failed to activate pad
    ERROR: Pipeline doesn't want to pause.
    ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Resource not found.
    Additional debug info:
    ../../../gstreamer-1.12.2/plugins/elements/gstfilesrc.c(535): gst_file_src_start (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
    No such file "test.jpeg"
    Setting pipeline to NULL ...
    Freeing pipeline ...

    Best Regards,
    Shigehiro Tsuda
  • Hello Shigehiro Tsuda,

    This error
    0:00:00.149052605 2471 0x17ada0 WARN filesrc gstfilesrc.c:535:gst_file_src_start:<filesrc0> error: No such file "test.jpeg"
    means that there is not such file. Please check is there a file with name test.jpeg.
    In additional you could set the full path to the file, here is example location=/home/root/test.jpeg if the file is under /home/root folder.

    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.

    An error also occurred with the full path (location = /home/root/test.jpeg).
    There is a file.
    Can you check if it works normally with normal JPEG file?
    It seems to be caused by the data format of the JPEG file.

    Best Regards,
    Shigehiro Tsuda

  • Hello,

    Please try:
    1.Open test.jpeg file on your PC can be open at all;
    2.Try with another jpg file;
    3. If 1 is working and 2 does not please share the file here.
    Thank you!

    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.

    I checked 10 types of JPEG file, but an error occurs. Nothing can be displayed normally on PC.
    An error similarly occurred in the following files in Processro SDK.
    /usr/share/ti/tidl/examples/test/testvecs/input/objects/*.jpeg

    Best Regards,
    Shigehiro Tsuda
  • Hello Shigehiro Tsuda,

    Thank you!
    I will check and back to you when I have an answer.

    BR
    Margarita
  • Hello Shigehiro Tsuda,


    You could try
    gst-launch-1.0 playbin uri=file:///usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg video-sink=waylandsink

    for now.

    BR
    Margarita
  • Hi Margarita,

    Thank you for your support.
    I tried it.
    No error occurred, the image of the cat was displayed for a moment.

    root@am57xx-evm:~# gst-launch-1.0 playbin uri=file:///usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg video-sink=waylandsink
    Setting pipeline to PAUSED ...
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "playbin0".
    Execution ended after 0:00:00.999736642
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...

    Best Regards,
    Shigehiro Tsuda
  • Hello,

    Great.
    Please if this answers your question click the "This resolved my issue" button.
    If you have new question/issue you could open a new e2e tread.

    BR
    Margarita
  • Hi Margarita,

    Thank you for your support.

    In this case, there is also in the log, but the display disappears in a moment.
    Please tell me how to keep showing it.

    Best Regards,
    Shigehiro Tsuda

  • Hello,

    Something like this should work:

    gst-launch-1.0 filesrc location=/usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg ! jpegparse ! queue ! jpegdec ! vpe ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink use-drm=true

    BR
    Margarita
  • Hello Shigehiro Tsuda,

    Please if this is working for you verify the answer.

    Thank you!

    BR
    Margarita

  • Hi Margarita,

    Thank you for your support.

    I checked with the command of your suggestion.

    It seems to be an error in executing jpegparse.
    Currently, only playbin seems to not work normally.

    gst-launch-1.0 --gst-debug=3 filesrc location=/usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg ! jpegparse ! queue ! ducatijpegdec ! vpe ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink use-drm=true
    Setting pipeline to PAUSED ...
    [ 4870.132407] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    0:00:00.150169800 1331 0x17afa0 WARN basesrc gstbasesrc.c:3480:gst_base_src_start_complete:<filesrc0> pad not activated yet
    Pipeline is PREROLLING ...
    0:00:00.151849496 1331 0x164490 WARN jpegparse gstjpegparse.c:705:gst_jpeg_parse_read_header:<jpegparse0> unhandled marker c2, leaving
    0:00:00.152231437 1331 0x164490 WARN baseparse gstbaseparse.c:3597:gst_base_parse_loop:<jpegparse0> error: Internal data stream error.
    0:00:00.152275682 1331 0x164490 WARN baseparse gstbaseparse.c:3597:gst_base_parse_loop:<jpegparse0> error: streaming stopped, reason not-negotiated (-4)
    ERROR: from element /GstPipeline:pipeline0/GstJpegParse:jpegparse0: Internal data stream error.
    Additional debug info:
    ../../../../gstreamer-1.12.2/libs/gst/base/gstbaseparse.c(3597): gst_base_parse_loop (): /GstPipeline:pipeline0/GstJpegParse:jpegparse0:
    streaming stopped, reason not-negotiated (-4)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    Freeing pipeline ...

    Best Regards,
    Shigehiro Tsuda

  • Hello,

    In my previous post there is another pipeline. Here is it:
    gst-launch-1.0 filesrc location=/usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg ! jpegparse ! queue ! jpegdec ! vpe ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink use-drm=true
    You could try it.

    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.
    I tried it, but it caused the following error.

    gst-launch-1.0 --gst-debug=2 filesrc location=/usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg ! jp
    egparse ! queue ! jpegdec ! vpe ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink use-drm=true
    0:00:00.098830247 1472 0x17d860 ERROR GST_PIPELINE grammar.y:740:gst_parse_perform_link: could not link jpegdec0 to vpe0
    WARNING: erroneous pipeline: could not link jpegdec0 to vpe0

    Best Regards,
    Shigehiro Tsuda
  • Hello,

    I have tested these pipelines on my side:

    gst-launch-1.0 playbin uri=file:///usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg video-sink="imagefreeze ! waylandsink"

    This is how you could display this jpeg image till you interrupt it with imagefreeze element.

    gst-launch-1.0 filesrc location=/usr/share/ti/tidl/examples/test/testvecs/input/objects/cat-pet-animal-domestic-104827.jpeg ! jpegparse ! queue ! jpegdec ! videoscale ! video/x-raw, width=800, height=480 ! imagefreeze ! waylandsink use-drm=true



    BR
    Margarita
  • Hi Margarita,

    Thank you for quick reply.
    I confirmed by two methods of your suggestion.
    As a result, both were successfully displayed.
    Thank you for your kind and detailed support.

    Best Regards,
    Shigehiro Tsuda
  • Hello,

    Thank you for verifying the thread.
    I would recommend you the playbin way.
    For new questions/issues please open a new e2e threads.

    BR
    Margarita