Just downloaded Gst and OMX, after a fair bit of messing about to produce a working pipeline I've got it all working producing an H264 MP4 time lapse from jpg stills taken every minute. The issues I sorted out:
Only making an video file containing 56 frames - don't use hours & minutes to "sequentially" number your still images. Doh!
Red/green coloured noise section/bar along the bottom of the video. I think this may be down to my orginal stills being 800x450. Saw a comment in another place that H264 should have dimensions divisable by 16. Changed the jpg's to 800x448 and the bar has now gone but I also changed other things before looking at the output again.
Files playable but would crash or confuse some players. Using do-timestamp=1 with multifilesrc and dts-method=asc presentation-time=1 with mp4mux seems to have cured that and a DTS unable to reorder error.
The only problem I have now is that of video quality, it's very low. No detail, unless it moves, blocky, etc. If I try to use the control-rate or target-bitrate settings for omxh264enc it fails with:
Code: Select all
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0: Could not initialise supporting library.
Additional debug info:
gstvideoencoder.c(1418): gst_video_encoder_change_state (): /GstPipeline:pipelin
e0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0:
Failed to open encoder
With --gst-debug 5 this is the relevant bit of the log:
Code: Select all
omx gstomx.c:1019:gst_omx_component_set_parameter:<omxh264enc-omxh264enc0>
Set video_encode parameter at index 0x06000004: Bad parameter (0x80001005)
0:00:02.485850673 3601 0xeae000 ERROR omxvideoenc gstomxvideoenc.c:307:gst_omx_video_enc_open:<omxh264enc-omxh264enc0
> Failed to set bitrate parameters: Bad parameter (0x80001005)
0:00:02.486065665 3601 0xeae000 WARN videoencoder gstvideoencoder.c:1418:gst_video_encoder_change_state:<omxh264enc-o
mxh264enc0> error: Failed to open encoder
The orginal jpgs are pretty good, example here (updates every minute, so a black farme during local night):
http://www.howhill.com/weather/webcam/camera-1.jpg I'm not scaling for the MP4. A short 10 s (660k) mp4 here:
http://www.howhill.com/weather/webcam/camera-1.mp4.
None of the decode methods of jpegdec make any difference to the mp4. Finally my pipeline:
Code: Select all
gst-launch-1.0 multifilesrc \
location="$path/camera-1-%04d.jpg" \
index="$start_index" stop-index="$stop_index" \
do-timestamp="1" \
caps="image/jpeg,frameframerate=$framerate/1" ! \
progressreport name=Progress: ! \
jpegdec ! \
omxh264enc ! \
h264parse ! \
mp4mux dts-method=asc presentation-time=1 ! \
filesink location="$path/camera-1.mp4"
It's in a bash script hence the variables. If the video quality could improved I'd be a very happy bunny.
Will the omxh264enc control-rate and target-bitrate have the desired effect? Or is it just lack of source data from the jpg's, would upping their resolution/quality help? Currently they are produced by raspistill at 800x448 with quality 15 and sharpness 75 to get the filesize down to something sensible on a web page.
Cheers
Dave.