[FFmpeg-user] Controlling an ffmpeg stream?

Reuben Martin reuben.m at gmail.com
Thu Sep 8 07:23:54 EEST 2016


On Wednesday, September 7, 2016 5:00:27 PM CDT Roy Pardi wrote:
> Hi, I am new to the list and also to ffmpeg so this is likely to be a naive
> question.
> 
> 
> My question concerns the command line version of ffmpeg. I am developing a
> cross-platform app in Adobe AIR and the problem I am trying to solve is
> being able to seek to an arbitrary point in a video file without having to
> render the video with a keyframe every frame. I am able to launch ffmpeg in
> the background and pipe a stream of an existing video file to my client
> app. Here are my questions:
> 
> 1. Am I wrong in my understanding that ffmpeg will seek to a requested time,
> rendering from the nearest keyframe?
> 
> 2. Using Actionscript I can successfully launch ffmpeg with:
> 
> 	ffmpeg -re -i  test.mp4  -c:a copy -c:v copy -f flv -
> 
> and subscribe to the stream and display it. I am also able to seek using:
> 
> 	ffmpeg  -ss 300 -re -i  test.mp4  -c:a copy -c:v copy -f flv -
> 
> What I am not able to do is to communicate with or control ffmpeg through
> stdin once it has started streaming, either to tell it to seek or to pause
> the stream. I can’t tell if my code is bad or if I misunderstanding the
> ffmpeg command line tool. Is the tool only designed for a "set up/run/exit”
> usage scenario.

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

-Reuben




More information about the ffmpeg-user mailing list