On Fri, Nov 13, 2009 at 02:24:47PM +0100, Reimar D?ffinger wrote: > On Fri, Nov 13, 2009 at 02:21:28PM +0100, Colin Rosenthal wrote: > > Reimar D?ffinger wrote: > > > On Thu, Nov 12, 2009 at 01:30:19PM +0100, Colin Rosenthal wrote: > > > > > >> I would like to be able to extract a single program from the file - with > > >> mencoder, if possible. > > >> For example we have tried > > >> > > >> mplayer/mencoder -demuxer lavf -tsprog 2005 -oac pcm -ovc copy -of avi > > >> -o out.avi mux2.share.ts > > >> > > >> This produces a playable avi file, but unfortunately not of the correct > > >> program. > > >> > > > > > > You need to port SVN r29846 to mencoder. > > You mean I need to patch mencoder myself based on the changes in mplayer? > > Yes (or of course wait/hope for someone else to do it). I realized that you unfortunately can't use quite the same code. You could test this: Index: mencoder.c =================================================================== --- mencoder.c (revision 29907) +++ mencoder.c (working copy) @@ -552,6 +552,14 @@ mencoder_exit(1,NULL); } + if (ts_prog) { + demux_program_t prog = { .progid = ts_prog }; + if (demux_control(demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM, &prog) != DEMUXER_CTRL_NOTIMPL) { + audio_id = prog.aid; // switching is handled by select_audio below + video_id = prog.vid; + demuxer_switch_video(demuxer, video_id); + } + } select_audio(demuxer, audio_id, audio_lang); if (dvdsub_id == -1 && dvdsub_lang)