Save an MPEG2 compressed file from live stream

Paul Barber paul.barber at
Tue Dec 9 02:32:51 PST 2014

Continuing with my project to display live video on 2 monitors and also save to file, I am confused about how to save an MPEG2 compressed file. This is for pictures only, no sound, and on Ubuntu 120.04 with GStreamer 1.2. I have tried these combinations:

avenc_mpeg2video ! filesink
This generates a file that can be viewed with Totem but something seems wrong with the meta data. Totem does not know how long the video is, so the progress bar through the video does not work.

avenc_mpeg2video ! mpegpsmux ! filesink
This generates a playable file approximately 50% of the time. When it can be read by Totem everything looks fine. When it cannot be read, Totem complains, "An error occurred. Could not determine type of stream."

avenc_mpeg2video ! avimux ! filesink
This generates a playable file. But other programs like Adobe Premier are not happy with this MPEG2 encoded video in an AVI container.

Could anyone give some advice on the best way to save a live stream to a compressed video file. Please let me know if you need more information.

More information about the gstreamer-devel mailing list