Discussion:
Ripping theora stream
Stefano Luceri
2011-08-17 13:34:13 UTC
Permalink
Thanks to #theora IRC channel I've ripped the RTP/THEORA packet stream to an
ogg file.
I used liboggz to write packet content (oggz_write_feed function).
The only problem I've found is related to header packets since rtp_theora
specification
(http://svn.xiph.org/trunk/theora/doc/draft-ietf-avt-rtp-theora-00.txt)
suggests to merge identification header and setup header in a single rtp
packet payload suppressing the comment one.
Solution to this problem is trivial:
1) Extract identification header it has a fixed length (42) and write it
down using oggz_write_feed
2) Create a dummy comment header:
Theora_comment tcom;
ogg_packet op_header_comment;

theora_comment_init(&tcom);
theora_encode_comment(&tcom, &op_header_comment)

// and write it down using oggz_write_feed

3) Extract setup header (the remaining playload from 1)) and write it using
oggz_write_feed

Now I've the following problem, playing the ogg file is very fast, is there
a way in theora to 'control' frame rate?
Moreover my next step consists in muxing audio/video (I can save it as a
separate WAV for now), what tool or library do you suggest for muxing?

Thank you,

Stefano
Hi,
I'm new to this mailing list. I'm trying to save a theora stream into an
OGG file (or something else). I've the theora packets received from a VoIp
application > (over RTP). I'm able to convert a single frame to a jpeg image
but I've no idea about how to write video file.
Maybe this is not the right place to answer this question but I'm loosing
my mind reading specs about file formats and conversion tools . any help
appreciated.
Thank you very much
Benjamin M. Schwartz
2011-08-17 14:17:36 UTC
Permalink
Post by Stefano Luceri
Now I've the following problem, playing the ogg file is very fast, is there
a way in theora to 'control' frame rate?
The frame rate is written in the setup header. You should check that
frame rate and see if it is correct. One possibility is that the
transmitter is lying to you about the frame rate. Another possibility is
that some frames are getting lost (RTP is a lossy protocol). When a frame
is lost, you should probably insert an empty (size 0) packet in the Ogg
stream so that you don't lose temporal synchronization.
Post by Stefano Luceri
Moreover my next step consists in muxing audio/video (I can save it as a
separate WAV for now), what tool or library do you suggest for muxing?
You can do the muxing using liboggz (it's not much more code than you have
already).

--Ben
Stefano Luceri
2011-08-19 10:45:18 UTC
Permalink
The problem of fast playing was a fault in writing down the packets. I set
up granulepos = 0 for all packets, most players didn't even open the file,
only mplayer open/play the file ad maximum speed.

I solved the problem checking if a packet is a keyframe using:

th_packet_iskeyframe(&op)

and adjusting consequently granulepos.

Such solution is not very fast but the ogg file produced seems to be ok and
seekable.

Stefano
Post by Stefano Luceri
Now I've the following problem, playing the ogg file is very fast, is
there a way in theora to 'control' frame rate?
The frame rate is written in the setup header. You should check that frame
rate and see if it is correct. One possibility is that the transmitter is
lying to >you about the frame rate. Another possibility is that some frames
are getting lost (RTP is a lossy protocol). When a frame is lost, you
should probably insert >an empty (size 0) packet in the Ogg stream so that
you don't lose temporal synchronization.
Post by Stefano Luceri
Moreover my next step consists in muxing audio/video (I can save it as
a separate WAV for now), what tool or library do you suggest for muxing?
You can do the muxing using liboggz (it's not much more code than you have
already).

Loading...