[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

Hi,
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://192.168.178.80:554/user=admin_password=PASSWORD_channel=1_stream=0.sdp?real_stream?tcp'


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)

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

        if (!ret)
            continue;
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);
/* end PANTELTJE MOD */



Recompiled, then use it like this:

 ffplay  'rtsp://192.168.178.80:554/user=admin_password=PASSWORD_channel=1_stream=0.sdp?real_stream?tcp' 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