Falguni Palan
Falguni Palan

Reputation: 23

How to form a gstreamer pipeline to encode mp4 video from tiff files?

I'm new to gstreamer and am stuck trying to form a gstreamer pipeline to encode mp4 video from tiff files on nvidia Jetson platform. Here is the pipeline I've come up with :

gst-launch-1.0 multifilesrc location=%03d.tiff index=0 start-index=0 stop-index=899     blocksize=720000 num-buffers=900 do-timestamp=true typefind=true ! 'video/x-raw,format=(string)RGB,width=(int)1280,height=(int)720,framerate=(fraction)30/1' !     videoconvert ! 'video/x-raw,format=(string)I420,framerate=(fraction)30/1' !     omxh264enc ! 'video/x-h264,stream-format=(string)byte-stream,framerate=(fraction)30/1' ! h264parse ! filesink sync=true location=test.mp4 -e

With this, the mp4 file gets created successfully and plays but the actual video content is all garbled. Any idea what am I doing wrong ? Thank You

Upvotes: 2

Views: 6241

Answers (1)

Florian Zwoch
Florian Zwoch

Reputation: 7373

You are not doing any demux/decode of your TIFF data, so you throw random bytes at the encoder.

Also you are doing a lot of things with caps without having proper elements between that could alter the formats correctly.

You should use decodebin to let GStreamer handle most of the things automatically. E.g. something like that:

multifilesrc ! decodebin ! videoconvert ! omxh264enc ! h264parse ! filesink

Depending on your encoder you want to force the color format to be a 4:2:0 so that it does not accidentally encode in 4:4:4 (which is not very common and not supported by many encoders):

multifilesrc ! decodebin ! videoconvert ! video/x-raw, format=I420 ! omxh264enc ! h264parse ! filesink

Upvotes: 2

Related Questions