Page 1 of 1

Generate timelapse from JPEGs, gstreamer hangs

Posted: Wed Aug 14, 2013 2:01 pm
by Protozoan
Situation:
I want to generate a timelapse on my Raspberry Pi 512mb, using the onboard H.264 encoder.

Input: +300 JPEG files (2592 x 1944 pixels), example: http://i.imgur.com/czohiki.jpg
Output: h264 video file (2592 x 1944 pixels)
GStreamer 1.0.8 + omxencoder (http://pastebin.com/u8T7mE18)
Raspberry Pi version: Jun 17 2013 20:45:38 version d380dde43fe729f043befb5cf775f99e54586cde (clean) (release)
Memory: gpu_mem_512=400

Gstreamer pipeline:

Code: Select all

sudo gst-launch-1.0 -v multifilesrc location=GOPR%04d.JPG start-index=4711 stop-index=4750 caps="image/jpeg,framerate=\(fraction\)25/1" do-timestamp=true ! omxmjpegdec ! videorate ! video/x-raw,framerate=1/5 ! videoconvert  ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! queue max-size-bytes=10000000 ! matroskamux ! filesink location=test.mkv --gst-debug=4
Problem:
Gstreamer hangs and no output is generated.

--gst-debug=4:

Code: Select all

0:00:01.027331700  2422  0x17824f0 INFO               GST_EVENT gstevent.c:709:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:29.346875982  2422  0x17824f0 INFO                 basesrc gstbasesrc.c:2619:gst_base_src_loop:<multifilesrc0> pausing after gst_base_src_get_range() = eos
--gst-debug=5:

Code: Select all

0:01:16.089222125  2232   0x1fa8f0 DEBUG                basesrc gstbasesrc.c:2773:gst_base_src_loop:<multifilesrc0> pausing task, reason eos
0:01:16.095962979  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:5251:gst_pad_pause_task:<multifilesrc0:src> pause task
0:01:16.107724723  2232   0x1fa8f0 DEBUG                   task gsttask.c:662:gst_task_set_state:<multifilesrc0:src> Changing task 0x2180a8 to state 2
0:01:16.435800597  2232   0x1fa8f0 DEBUG              GST_EVENT gstevent.c:300:gst_event_new_custom: creating new event 0x129f80 eos 28174
0:01:16.436191588  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:4628:gst_pad_push_event:<multifilesrc0:src> event eos updated
0:01:16.436414584  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:3333:check_sticky:<multifilesrc0:src> pushing all sticky events
0:01:16.436620579  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event stream-start was already received
0:01:16.436816575  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event caps was already received
0:01:16.437001571  2232   0x1fa8f0 DEBUG               GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event segment was already received
0:01:16.440457495  2232   0x1fa8f0 DEBUG              GST_EVENT gstpad.c:4771:gst_pad_send_event_unchecked:<omxmjpegdec-omxmjpegdec0:sink> have event type eos event at time 99:99:99.999999999: (NULL)
0:01:16.449986289  2232   0x1fa8f0 DEBUG           videodecoder gstvideodecoder.c:1144:gst_video_decoder_sink_event:<omxmjpegdec-omxmjpegdec0> received event 28174, eos
0:01:16.462165024  2232   0x1fa8f0 DEBUG            omxvideodec gstomxvideodec.c:2489:gst_omx_video_dec_drain:<omxmjpegdec-omxmjpegdec0> Draining component
0:01:16.463930986  2232   0x1fa8f0 DEBUG                    omx gstomx.c:1223:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> Acquiring video_decode buffer from port 130
0:01:16.465537951  2232   0x1fa8f0 DEBUG                    omx gstomx.c:1334:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> video_decode port 130 has pending buffers
0:01:16.466576928  2232   0x1fa8f0 DEBUG                    omx gstomx.c:1353:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> Acquired buffer 0x21f938 (0xb2068550) from video_decode port 130: 0
0:01:16.468237892  2232   0x1fa8f0 DEBUG                    omx gstomx.c:1375:gst_omx_port_release_buffer:<omxmjpegdec-omxmjpegdec0> Releasing buffer 0x21f938 (0xb2068550) to video_decode port 130
0:01:16.470360846  2232   0x1fa8f0 DEBUG                    omx gstomx.c:1420:gst_omx_port_release_buffer:<omxmjpegdec-omxmjpegdec0> Released buffer 0x21f938 to video_decode port 130: None (0x00000000)
0:01:16.472046809  2232   0x1fa8f0 DEBUG            omxvideodec gstomxvideodec.c:2544:gst_omx_video_dec_drain:<omxmjpegdec-omxmjpegdec0> Waiting until component is drained
Full console dump: https://mega.co.nz/#!eI1ASBSY!R4mnuGqRH ... 4stu50LnOw

Question:
1. What am I doing wrong?
2. Is there another or more efficient way to create high res timelapses from JPEGs on a raspberry pi?

Re: Generate timelapse from JPEGs, gstreamer hangs

Posted: Wed Aug 14, 2013 5:37 pm
by towolf
Perhaps the resolution is too high for the hardware? Try using smaller JPGs?

Re: Generate timelapse from JPEGs, gstreamer hangs

Posted: Thu Aug 15, 2013 8:03 am
by Protozoan
towolf wrote:Perhaps the resolution is too high for the hardware? Try using smaller JPGs?
Just tried it, JPEGS sized 1440px X 1080px, still hangs on 'Waiting until component is drained':
0:00:54.249905915 2391 0x152e0c0 DEBUG multifilesrc gstmultifilesrc.c:345:gst_multi_file_src_create:<multifilesrc0> reading from file "GOPR5081.JPG".
0:00:54.317843441 2391 0x152e0c0 DEBUG basesrc gstbasesrc.c:2462:gst_base_src_get_range:<multifilesrc0> create returned -3 (eos)
0:00:54.325084284 2391 0x152e0c0 INFO basesrc gstbasesrc.c:2619:gst_base_src_loop:<multifilesrc0> pausing after gst_base_src_get_range() = eos
0:00:54.325309279 2391 0x152e0c0 DEBUG basesrc gstbasesrc.c:2773:gst_base_src_loop:<multifilesrc0> pausing task, reason eos
0:00:54.332808116 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:5251:gst_pad_pause_task:<multifilesrc0:src> pause task
0:00:54.340698944 2391 0x152e0c0 DEBUG task gsttask.c:662:gst_task_set_state:<multifilesrc0:src> Changing task 0x15458a8 to state 2
0:00:54.345632836 2391 0x152e0c0 DEBUG GST_EVENT gstevent.c:300:gst_event_new_custom: creating new event 0x1460f80 eos 28174
0:00:54.346014828 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:4628:gst_pad_push_event:<multifilesrc0:src> event eos updated
0:00:54.346237823 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:3333:check_sticky:<multifilesrc0:src> pushing all sticky events
0:00:54.346446818 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event stream-start was already received
0:00:54.346635814 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event caps was already received
0:00:54.346817810 2391 0x152e0c0 DEBUG GST_PADS gstpad.c:3282:push_sticky:<multifilesrc0:src> event segment was already received
0:00:54.347018806 2391 0x152e0c0 DEBUG GST_EVENT gstpad.c:4771:gst_pad_send_event_unchecked:<omxmjpegdec-omxmjpegdec0:sink> have event type eos event at time 99:99:99.999999999: (NULL)
0:00:54.353885657 2391 0x152e0c0 DEBUG videodecoder gstvideodecoder.c:1144:gst_video_decoder_sink_event:<omxmjpegdec-omxmjpegdec0> received event 28174, eos
0:00:54.365725400 2391 0x152e0c0 DEBUG omxvideodec gstomxvideodec.c:2489:gst_omx_video_dec_drain:<omxmjpegdec-omxmjpegdec0> Draining component
0:00:54.367005372 2391 0x152e0c0 DEBUG omx gstomx.c:1223:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> Acquiring video_decode buffer from port 130
0:00:54.368405341 2391 0x152e0c0 DEBUG omx gstomx.c:1334:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> video_decode port 130 has pending buffers
0:00:54.369880309 2391 0x152e0c0 DEBUG omx gstomx.c:1353:gst_omx_port_acquire_buffer:<omxmjpegdec-omxmjpegdec0> Acquired buffer 0x154d050 (0xb228d530) from video_decode port 130: 0
0:00:54.371333278 2391 0x152e0c0 DEBUG omx gstomx.c:1375:gst_omx_port_release_buffer:<omxmjpegdec-omxmjpegdec0> Releasing buffer 0x154d050 (0xb228d530) to video_decode port 130
0:00:54.373411233 2391 0x152e0c0 DEBUG omx gstomx.c:1420:gst_omx_port_release_buffer:<omxmjpegdec-omxmjpegdec0> Released buffer 0x154d050 to video_decode port 130: None (0x00000000)
0:00:54.374696205 2391 0x152e0c0 DEBUG omxvideodec gstomxvideodec.c:2544:gst_omx_video_dec_drain:<omxmjpegdec-omxmjpegdec0> Waiting until component is drained

Re: Generate timelapse from JPEGs, gstreamer hangs

Posted: Thu Aug 15, 2013 12:22 pm
by towolf
If you just use jpegdec? Does it work then?

Re: Generate timelapse from JPEGs, gstreamer hangs

Posted: Tue Nov 10, 2015 8:33 am
by Gamadril
Did you find a solution for that? jpegdec would work, but in my case I want to use playbin to show jpeg images and videos. Get the same lock "Waiting until component is drained" when playing images. And I can see no way to tell playbin to use jpegdec for decoding instead of omxmjpegdec.

Re: Generate timelapse from JPEGs, gstreamer hangs

Posted: Mon Jun 13, 2016 7:06 am
by nitschkecm
I have had a Gstreamer Pipeline working for over 1 year but for some reason something must have changed. Whilst my pipe

Code: Select all

gst-launch-1.0 -v multifilesrc location=image_%04d.jpg caps="image/jpeg,framerate=\(fraction\)30/1" ! jpegdec ! queue ! videoscale ! video/x-raw, width=1296, height=976 ! queue ! omxh264enc target-bitrate=15000000 control-rate=variable ! video/x-h264, profile=high ! h264parse ! mp4mux ! filesink location=todays_video.mp4
It does produce my video and still does it fast. I can play it perfectly on VLC but there is some incompatibility with Youtube. I used to upload it directly from the script to youtube. When it uploads it stays for a very long time in "processing" and then shows that the video has a length of more then 39 minutes whilst the original is only 62 second.

Anybody else seen something like this or any suggestion for fix ?

Happy to upload the pictures / video in case it makes sense