[FFmpeg-user] Controlling an ffmpeg stream?

Reuben Martin reuben.m at gmail.com
Wed Sep 21 07:29:12 EEST 2016


On Tuesday, September 20, 2016 5:45:16 PM CDT Roy Pardi wrote:
> > On Sep 8, 2016, at 12:23 AM, Reuben Martin <reuben.m at gmail.com> wrote:
> > 
> > You can send commands to ffmpeg via stdin, however be aware that you have
> > to use filters rather than regular ffmpeg arguments to do so. For
> > example, the command you gave would be modified to this:
> > 
> > ffmpeg -f lavfi -i movie=filename=’test.mp4’:streams=0+1[out0][out1]  -c:a
> > copy -c:v copy -f flv -
> > 
> > And the command would be the “seek” command. You can read about it here
> > under the “commands” sub-section:
> > http://www.ffmpeg.org/ffmpeg-filters.html#movie-1
> 
> I posted a couple of weeks ago but I am still struggling with this.
> 
> To recap. . . I am using Adobe AIR and Actionscript to launch ffmpeg using
> AIR’s NativeProcess
> <http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/d
> esktop/NativeProcess.html> I can successfully load a video using this:
> 
> 	ffmpeg -re -i  test.mp4  -c:a copy -c:v copy -f flv -
> 
> but I want to be able to communicate with ffmeg after the stream starts in
> order to seek. I’ve tried the suggestion about about using filters but I
> don’t have the syntax right (I guess). I don’t get an error but nothing
> happens. I realize that probably no one here is familiar with Actionscript,
> etc. but maybe that doesn’t matter as much as the syntax I am using in my
> command
> 
> 
> Based on the suggestion above I am building a string and then writing it to
> stdin
> 
> var cmd:String = "-f lavfi -i movie=filename='" + videoPath +
> "':streams=0+1[out0][out1]  -c:a copy -c:v copy -f flv -"
> 
> ffmpegProcess.standardInput.writeUTF(cmd + "\n");
> 
> Can someone give me a nudge in the right direction? What I am trying to do
> is build a video player using ffmpeg so I can use video formats which are
> not supported by AIR.
> 
> thanks!
> 
> –Roy
> 

Try seeing if you can get it to work directly from the terminal first. I know 
that in the terminal I have to type “c” or “C” before inputing a command. You 
probably need to send the same to the fd for the subprocess stdin as well. 

Running from the terminal also lets you see stderr output that gives parse 
errors telling what you did wrong trying to input a command.

Also, not sure what I was smoking when I wrote to use “-c:a copy -c:v copy”. 
That will not work since at that point the inputs are uncompressed raw video 
and audio. You would have to encode them before output to flv.

-Reuben




More information about the ffmpeg-user mailing list