GNOME Bugzilla – Bug 578966
Using seek to segment video produces garbage
Last modified: 2009-08-28 13:49:23 UTC
Please describe the problem: I am trying to segment a video using gstreamer (via gstreamer-java). I have the equivalent of this pipeline: filesrc location=${input} ! decodebin name=dec ffmux_asf name=mux ! filesink location=${output} dec. ! queue ! ffmpegcolorspace ! ffenc_wmv2 ! queue ! mux. dec. ! queue ! audioconvert ! lame ! mp3parse ! queue ! mux. This pipeline works if I don't do a seek but if I do a seek it produces a file that is not identifiable as a video although it seems to be about the right size. Here's the seek code which works on other pipelines: int flags = SeekFlags.FLUSH | SeekFlags.SEGMENT | SeekFlags.KEY_UNIT; boolean success = gpipe.seek(1.0, Format.TIME, flags, SeekType.SET, startClock.toNanos(), SeekType.SET, endClock.toNanos()); Steps to reproduce: 1. I am trying to segment a video using gstreamer (via gstreamer-java). I have the equivalent of this pipeline: filesrc location=${input} ! decodebin name=dec ffmux_asf name=mux ! filesink location=${output} dec. ! queue ! ffmpegcolorspace ! ffenc_wmv2 ! queue ! mux. dec. ! queue ! audioconvert ! lame ! mp3parse ! queue ! mux. This pipeline works if I don't do a seek but if I do a seek it produces a file that is not identifiable as a video although it seems to be about the right size. Here's the seek code which works on other pipelines: int flags = SeekFlags.FLUSH | SeekFlags.SEGMENT | SeekFlags.KEY_UNIT; boolean success = gpipe.seek(1.0, Format.TIME, flags, SeekType.SET, startClock.toNanos(), SeekType.SET, endClock.toNanos()); 2. This produces an output file that is not recognizable or playable via gstreamer or other video players. 3. Actual results: An output file of approximately the correct size is generated but it is unplayable. Expected results: I expect the generated video segment to be playable. Does this happen every time? yes Other information: This happens on Fedora 10 64 bit and Ubuntu 8.10 32 bit.
You probably don't want the SEGMENT flag (it stops emiting EOS at the end, which might cause the headers to not be flushed out). You probably also don't want to encode the bits before you do the seek. This you can do with using pad blocks (http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt see the part about prerolling a partial pipeline) You also probably just want to use gnonlin to cut the video in pieces.