[FFmpeg-devel] modify ffplay for dumpstream in rtsp?

Jan Panteltje ffmpeg at panteltje.com
Sat Oct 3 10:32:00 CEST 2015

// ffmpeg-devel at ffmpeg.org

I was experimenting with using ffplay to display cameras from my DVR video recorder'srtsp stream.
This works perfectly (Chinse video recoder with H264 outoput for4 cameras) like this:

/root/compile/ffmpeg/ffmpeg-1.1/ffplay  'rtsp://'

As I found no way to record from it at the same time?? (maybe ffmpeg can but no luck so far),
I decided to try to add some output stream to fflay.

I modified ffplay.c
in function:
 static int video_thread(void *arg)

        ret = get_video_frame(is, frame, &pts_int, &pkt, &serial);
        if (ret < 0)
            goto the_end;

        if (!ret)
I added:

/* Start PANTELTJE MOD */ 
#include <unistd.h>
	//fprintf(stderr, "WAS 1 pkt.size=%d\n", pkt.size);
	// ssize_t write(int fd, const void *buf, size_t count);

 write(fileno(stdout), pkt.data, pkt.size);

Recompiled, then use it like this:

 ffplay  'rtsp://' 1>myfile.mp4

Amazingly this worked first time, and I can play it back no problem with an unmodified version of ffplay :-)

There is _one_ problem however, the recorded file plays back at what looks like double speed.

I was thinking about adding a command line option to ffplay to enable the 'dump to stdout' modification,
but am taken aback by why I do not understand the double speed effect in playback.
I know very little about H264 sooo

What is going on here?

More information about the ffmpeg-devel mailing list