Recording to QT format

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Dec 18 16:16:25 PST 2012


On Tue, 2012-12-18 at 16:43 +0000, Ian Davidson wrote:

Hi Ian,

> You may have noticed a few posts from me recently regarding recording to 
> AVI format.  From my perspective, the important part of the process is 
> to get the information _recorded_ so that I can edit the recorded 
> material and write to a DVD - so it does not have to be AVI.  I would be 
> happy with OGG or MPEG so long as I can carry the file to another 
> machine and edit it.

Ok. Which container to use depends a bit on the codec I guess, and on
what your editing software supports (container + codecs). Quicktime/MP4
would usually be a good choice for this kind of thing.


> I have successfully made a recording using
> gst-launch-1.0 -e v4l2src norm=PAL ! 
> 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' 
> ! queue ! mux. alsasrc num-buffers=440 ! audioconvert ! 
> 'audio/x-raw,rate=44100,channels=2' ! queue ! mux. avimux name=mux ! 
> filesink location=test.avi
> - although I have not attempted to verify that the audio is in sync with 
> the video.

Ok. You might want/need a videorate element between the video source and
the muxer, and an audiorate element between the audio source and the
muxer (to make sure the stream is 'perfect' timestamp/data wise and
there are no gaps - AVI doesn't handle those things very well and you
might get A/V sync issues otherwise).


> I then tried to change from AVI to QT using
> gst-launch-1.0 -e v4l2src norm=PAL ! 
> 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' 
> ! videoconvert ! queue ! mux. alsasrc num-buffers=440 ! audioconvert ! 
> 'audio/x-raw,rate=44100,channels=2' ! queue ! mux. qtmux name=mux ! 
> filesink location=test.mov
> - but when I play the video, I do not hear any audio.
> 
> I have inspected qtmux to verify that it can take an audio input. 
> (Check). So what have I done wrong to lose the audio?

Very odd! It appears to be a bug, probably in qtmux. It does not work
with audiotestsrc either for me, nor in 0.10. Please file a bug.


> Would I be better to choose OGG or MPEG?  I am thinking that the 
> multifilesink would be a useful thing to use.

Ogg/MPEG aren't good containers for dumping raw audio/video into. They
work well with multifilesink though.

> I have attempted to use oggmux as in the following command
> gst-launch-1.0 -e v4l2src norm=PAL ! 
> 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' 
> ! videoconvert ! queue ! mux. alsasrc num-buffers=440 ! audioconvert ! 
> 'audio/x-raw,rate=44100,channels=2' ! queue ! mux. oggmux name=mux ! 
> filesink location=test.ogg
> - but it fails to link mux to the (video) queue.
> 
> Your help, as ever, is appreciated.

Ogg doesn't support raw video. (Theoretically it does via the ogm
extension, but we don't have a formatter for that and it's a bit
exotic).

There's a mapping for raw audio (OggPCM) but we don't support that yet.
You could encode to vorbis (lossy) or FLAC (lossless) instead.

Try encoding the video to VP8 or Theora or Dirac (with schroenc). Might
need to find out some suitable settings though (maybe I-frame only,
etc.).

Again, you might want to check the capabilities of your video editing
software. You can probably count the number of applications supporting
Ogg on the fingers of one hand (if not one finger of one hand).

For mp4/quicktime, H.264 would be a good format to encode to (and
x264enc is very versatile).

 Cheers
  -Tim



More information about the gstreamer-devel mailing list