I'm working on a real time image processing system and I'd like to "Tee" off the input video and save it to a file for a variety of reasons -- archiving epochs of particular interest, re-analysis with algorithms that can't yet run in real time, system verification, etc. Previous work has shown that good quality compression (like with a commercial DVD Recorder) is acceptable (we've been using SVHS recorders for ~20 years :) )
I first tried: jpegenc, mpeg2enc, and theoraenc. I could eliminate mpeg2enc from a combination of too high CPU load and too low video quality (using only the defaults). If I'm wrong about mpeg2enc please set me straight about how to get good results from it. Here some sample pipelines gst-launch v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! tee name=t ! queue ! wally ! xvimagesink t. ! queue ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=mjpeg.avi gst-launch v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! tee name=t ! queue ! wally ! xvimagesink t. ! queue ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=theora.ogv The wally plug-in is a simple filter plug-in I wrote that does a simple transformation of the video data as a proxy for my image processing. Both pipelines seem to work OK but CPU usage seems high with theoraenc being about 40% more CPU but with about half the file size of jpegenc. My problem here is while the files play back fine in Totem, there is something wrong with them if I try to play them on a Windows system (that is set up for MJPEG and OGG/Theora). Not a show stopper, but I'd love clues as to what might be making these files not usable on Windows. Then I discovered y4menc: gst-launch v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! y4menc ! filesink location=y4menc.yuv while it gives about 30X the file size of theoraenc it uses very little CPU, less than half of the jpegenc pipeline. The doc at: http://www.gstreamer.net/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-y4menc.html doesn't really tell me anything helpful. What are some of the pros and cons (other than gigantic files) of y4menc, and what is its intended purpose? I don't seem to be able to pipe it into one of the container formats like avimux, oggmux, or matroskamux. If I do "Open With Media Player" the file appears to play fine, although it seems playback in Totem doesn't seek. I can play it back with: gst-launch filesrc location=y4menc_big.yuv ! decodebin ! ffmpegcolorspace ! xvimagesink Having captured & played back an ~10 minute clip into a 9.7 GB file (apparently glitch free!) while composing this message I'm most impressed with this aspect of gstreamer performance! Are there better encoders in gstreamer that perhaps I don't have or know about? (I've installed about everything gst related that is available in the Ubuntu repos). |
On 12/03/2010 04:53 PM, wally_bkg wrote:
> I first tried: jpegenc, mpeg2enc, and theoraenc. I could eliminate mpeg2enc > from a combination of too high CPU load and too low video quality (using > only the defaults). All of these elements take an argument that allows you to specify your desired bitrate/quality. There's nothing especially great about the defaults, which may be incomparable from one element to another. > Both > pipelines seem to work OK but CPU usage seems high with theoraenc being > about 40% more CPU but with about half the file size of jpegenc. This is not a surprise. Theora compresses video by comparing frames to each other, while JPEG compresses each frame independently. Theora will always achieve better quality in the same output filesize, but will use more CPU. My > problem here is while the files play back fine in Totem, there is something > wrong with them if I try to play them on a Windows system (that is set up > for MJPEG and OGG/Theora). If you want help debugging this you'll need to be more specific about the playback system and the problem. Latest VLC generally plays back Theora correctly under Windows. > Then I discovered y4menc: > while it gives about 30X the file size of theoraenc it uses very little CPU, > less than half of the jpegenc pipeline. y4m is uncompressed lossless raw video. Maybe you would enjoy http://xiph.org/video/vid1.shtml --Ben ------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel signature.asc (205 bytes) Download Attachment |
I guess this is why video editors like Pitivi generally do a crappy job of actually producing output -- expecting either the application developer, or worse the end user, to be expert in encoding parameters instead of providing reasonable defaults. The default quality for theoraenc and jpegenc were usable, the defaults fro mpeg2enc were so far from usable I wouldn't know where to start changing things. I was using the K-lite Codec pack and "Media Player Classic" on Windows. As I said, the system plays every MJPEG and OGV file I'd thrown at it until these samples I created with gstreamer. I downloaded VLC-win32 1.1.5 and it plays the OGV file back OK. I guess my Codec pack is out of date. I was worried something was wrong with the file headers But VLC doesn't play the MJPEG file, so maybe something is not setup correctly for avimux. I was aware of this, but since a y4mdec seems to be missing I was wondering how it was intended to be used since I couldn't seem to find a video file format that would "wrap" it so seeking would work. As I said, decodebin let me play it back, got some playback speed glitches, but the images all looked good and in proper sequence -- I was quite impressed with the handling of an ~10GB file on my 64-bit system. Thanks for the link. |
In reply to this post by wally_bkg
Just to close the thread in case someone else has the same issue, the motion jpeg avi issue is solved by adding a -e to the gst-launch command so a Ctrl-C to stop the recording sends an EOS to the elements (gleaned from another thread) which seems to cause the avimux to do something to the file that is needed on Windows, but not on Linux (at least if playing back with gstreamer via Totem).
I updated my K-lite Codecs on Windows but the theoraenc->oggmux ogv file still doesn't play beyond the first few frames. Adding the -e made no difference, although either ogv file plays on Windows using vlc-win32-1.1.5. The ogg/theora video example files distributed with Ubuntu all play fine on my windows system so it seems something is different between the theoraenc->oggmux file and the Ubuntu distributed samples that vlc understands, but breaks the most recent K-lite theora/ogg codec. |
Hi Wally,
Did you decide not to use y4menc? If so why? I am at the same decision point, but I don't really want 1GB per minute filesize. Regards Steve _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
No i didn't end up using y4menc. I found: encode=gst_element_factory_make("ffenc_mpeg4", "encoder"); mux=gst_element_factory_make("ffmux_mp4", "muxer"); g_object_set (G_OBJECT (encode), "bitrate", 2000000, NULL); // ~15MB/minute g_object_set (G_OBJECT (encode), "interlaced", TRUE, NULL); seems to work OK for us so far. There is precious little documentation about ffenc_mpeg4. Good Luck! |
Free forum by Nabble | Edit this page |