My first guess about the problem would be that the programs want to process the stuff in a different order, e.g. mplayer wants to output some sound before anymore video and encoder_example wants to receive some video before anymore sound. This could easily depend on the order of stuff in the file mplayer is reading. I guess something similar could happen for opening the pipes as well. The easiest solution I can think of would be to run 2 mplayer processes, one for video and one for audio. Based on your (emaillist@dogphilosophy.net) example, something like this: (in one terminal window): mplayer -vo yuv4mpeg -ao null -vop scale=640:480 -sws 2 test.mpg (in another): mplayer -vo null -ao pcm -aofile stream.wav -aop list=resample:fout=44100 (in another): strace encoder_example -a 1 -v 1 stream.wav stream.yuv > movie.ogg 2>enc.err <p>That's a bit wasteful, but I think it will work. I haven't tried it. -- Caspian Maclean --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
emaillist@dogphilosophy.net
2002-Oct-03 09:34 UTC
[theora-dev] Audio from fifo - That was it exactly
On Thursday 03 October 2002 12:48 am, Caspian Maclean wrote:> My first guess about the problem would be that the programs want > to process the stuff in a different order, e.g. mplayer wants to > output some sound before anymore video and encoder_example wants > to receive some video before anymore sound. This could easily > depend on the order of stuff in the file mplayer is reading. >[...]> The easiest solution I can think of would be to run 2 mplayer > processes, one for video and one for audio.[...]> That's a bit wasteful, but I think it will work. > I haven't tried it.BINGO, as they say. It appears you got it exactly right. I just tried it as you described and it works. This also explains why the separate mp2enc and mpeg2enc programs worked (mp2enc, for example, is only dealing with the audio stream, so it doesn't metaphorically butt heads with the video encoder...) - and makes me think that if I had a 'monolithic' mp2-and-mpeg2 encoder program that it'd have the same problem... It further explains why DivX gets one step further into the audio before getting stuck (presumably has a little more audio data before the video stream starts?). I suspect once the API/Format is solidified and people start work on 'production' implementations that they'll be 'buffering' a certain amount of the streams before they start processing to get around this issue? That being the case, is there any chance that the next test release (soon?) include a 'muxer_example' that can take audio from one .ogg file and video from another to create a unified Ogg Theora file from them (so that audio could be encoded with vorbisenc or whatever utility and the video alone could be handled by the encoder_example, analogous to the way mp2enc and mpeg2enc work - mainly for performance and quality comparisons...)? Thanks! Incidentally, the video I'm testing on is from the Prelinger archives, and therefore should be freely redistributable. I downloaded the high-quality mpeg2 version and am using it to test the re-encoding. If it would be useful to someone, I can encode the file at a couple of different bitrate/quality settings and upload the resulting 'Ogg-Theora-Alpha-One' files somewhere as 'real world' examples... P.S. I also would vote for 'aspect ratio' support soon, but while I imagine adding it to the ENcoder would be a relatively trivial (I say this with the assuredness of someone who assumes SOMEONE ELSE will do it ) matter of adding a command-line switch to the encoder_example (and, of course, agreeing on how and where to represent that bit of information in the video stream), adding it to the DEcoder would involve adding routines to do scaling of the video before display, which I imagine is rather less trivial - so I'm guessing it's probably not worth the effort until the structure is more finalized... --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
I haven't tried it, but here's an extremely trivial patch for encoder_example that should make it work. It's been mentioned many times that Theora isn't production code, but this could help with testing: --cut-- --- encoder_example.c.~1.6.~ 2002-09-27 19:51:01.000000000 -0400 +++ encoder_example.c 2002-10-03 18:25:18.000000000 -0400 @@ -597,11 +597,11 @@ ogg_page audiopage; ogg_page videopage; - /* is there an audio page flushed? If not, fetch one if possible */ - audioflag=fetch_and_process_audio(audio,&audiopage,&vo,&vd,&vb,audioflag); - /* is there a video page flushed? If not, fetch one if possible */ videoflag=fetch_and_process_video(video,&videopage,&to,&td,videoflag); + + /* is there an audio page flushed? If not, fetch one if possible */ + audioflag=fetch_and_process_audio(audio,&audiopage,&vo,&vd,&vb,audioflag); /* no pages of either? Must be end of stream. */ if(!audioflag && !videoflag)break; --cut-- --Ken On Thursday 03 October 2002 02:48 am, Caspian Maclean wrote:> My first guess about the problem would be that the programs want > to process the stuff in a different order, e.g. mplayer wants to > output some sound before anymore video and encoder_example wants > to receive some video before anymore sound. This could easily > depend on the order of stuff in the file mplayer is reading. > > I guess something similar could happen for opening the pipes as > well. > > The easiest solution I can think of would be to run 2 mplayer > processes, one for video and one for audio.--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.