Re: [LAD] Mplayer (ffmpeg) decode to stdout

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Wednesday, February 1, 2012 - 3:37 am

Tnx Robinffmpeg also works excellent as decoer.W=
ith   ffmpeg -i /some/file -f u16le  -ar 44100 | myprog ...=
i gotta horrable sound. Probably U mean  -f s16le !&#1=
60;So, i have rewrited my olde 2-fork mpg123 mixer as 1-fork ffm=
peg "frontend"http://martini.pudele.com/radio/programming/audio/=
ffmpegdec02.cfundamentally without any changes, except #define PLAYER_BIN "/usr/bin/ffmpeg"   execlp(P=
LAYER_BIN,PLAYER_BIN, "-i", mxk.trknamep, "-f", "s16le", "-ar","44100", "-v=
","0" ,"-", NULL); Any loud output messages i dr=
ain out simple with close(2); after fork();So far everything is =
OK, if i decode whole files. It seems that ffmpe=
g during da decoding set terminal in canonical mode.If i decode =
only part of file, and kill() em @ middle of decoding,ffmpeg doe=
s not restore normal terminal mode , and i do not see commands which i type=
=2EThen helps (blind typed) command "reset".I tried s=
end several signals with kill() SIGKILL 2 SIGTSTP SIGQUIT SIGINT 15 ...,&#1=
60;but none of em has handler for terminal restore.&#=
160;I fixed this behavior with #include <term=
ios.h>struct termios tsave;   /*  ! ! ! F-king ffmp=
eg ! ! ! *//* sets canonical input mode *//*----*/voi=
d save_terminal(void)/*----*/{ struct termios tbuf;/*=
----*/  tcgetattr(0,&tbuf);/*----*/  tsave=3Dtbuf;=
/*----*/} /* restore the settings */<=
/div>/*----*/void restore_terminal(void)/*----*/{  tcs=
etattr(0,TCSANOW,&tsave);  } I have tri=
ed close(0); where 0=3Dstdin , after fork(); but program has frozen.<=
div> How do i decouple childs stdin from terminal or redire=
ct em from /dev/null ?  Tnx in a=
dvance @ all   That's probably why mplayer devs recommend using mkfifo (n=
amed pipe) instead of stdout.. 'mencoder' can do it. If =
you need to support a variety of unknown formats and codecs: ffmpeg i=
s an alternative and gstreamer might be one. ffmpeg -i /some/f=
ile -f u16le -acodec pcm_s16le -ar 44100 - \ | jack-stdin system:play=
back_1 system:playback_2 on that note, `jack-stdout` can captu=
re and pipe raw PCM data from any JACK-application including `mplayer=
-ao jack /some/file`. YMMV. HTH, robin ----

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] Mplayer decode to stdout, Alfs Kurmis, (Sat Jan 28, 10:36 pm)
Re: [LAD] Mplayer decode to stdout, Robin Gareus, (Sun Jan 29, 12:37 am)
Re: [LAD] Mplayer (ffmpeg) decode to stdout, Alfs Kurmis, (Wed Feb 1, 3:37 am)
Re: [LAD] Mplayer decode to stdout, Robin Gareus, (Sun Jan 29, 12:41 am)
Re: [LAD] Mplayer decode to stdout, Paul Davis, (Sat Jan 28, 10:41 pm)
Re: [LAD] Mplayer decode to stdout, Alfs Kurmis, (Sat Jan 28, 11:31 pm)
Re: [LAD] Mplayer decode to stdout, Adrian Knoth, (Sun Jan 29, 12:33 am)
Re: [LAD] Mplayer decode to stdout, Dan Muresan, (Sun Jan 29, 8:12 am)