Search code examples
tcpffmpegh.264mpeg-4

ffmpeg can play video but not a stream containing the same data


This is my first time encountering video codecs/video streaming.

I am receiving raw h.264 packets over TCP. When I connect to the socket, listen to it and simply save the received data to a file, I am able to play it back using

ffplay data.h264

However, when I try to directly play it from the stream without saving it, using

ffplay tcp://addr:port

all I get is the error

Invalid data found when processing input

Why is that?


Solution

  • Alright I found another way to display the video stream.

    ffplay -f h264 -codec:v h264 tcp://addr:port?listen
    

    The ?listen parameter makes it so ffplay creates its own tcp server. All I do now is send the data to the specified address.