1

I am piping raw YUV444 640x480 frames to ffmpeg from inside a C++ program using stdout (Pipe format: pipe<-Y<-U<-V whole frames each). ffmpeg encodes them using h.264 and streams the video via UDP to an IP of my choice.

When I am not streaming and saving the video on the recording device as -mp4 file with ffmpeg, everything works - But when I stream over the network and try to receive in VLC, the stream is received and the playing timer under the video screen runs,but the image is black, none of the video is displayed. Also I have some crackling sounds on my audio output. The raw video does not have an audio track.

My ffmpeg settings are as follows:

ffmpeg -y -loglevel verbose -f rawvideo -r 25 -c:v rawvideo -pix_fmt yuv444p -s 640x480 -i - -c:v libx264 -preset superfast -framerate 25 -f mpegts udp://192.168.150.1:20001

in VLC (GUI), I just use "open network stream" with udp://@:20001. The port is open, I tested it with a simple dummy sender/receiver. Almost the same cli arguments for the video recording lead to a perfectly playable video when writing to a file and downloading it:

ffmpeg -y -loglevel verbose -f rawvideo -r 25 -c:v rawvideo -pix_fmt yuv444p -s 640x480 -i - -c:v libx264 -preset superfast -framerate 25 video.mp4

If I try to stream the same recorded video using

ffmpeg -i video.mp4 -v 0 -vcodec mpeg4 -f mpegts udp://192.168.150:20001

I get a black screen again, like above.

The VLC log output identifies my stream as mp3, so maybe stream type recognition is to blame. But why?

Here are the ffmpeg console output and the VLC log.

What am I doing wrong?

PS: Moved this question over here from Stack Overflow because it was not getting any answers, old unanswered duplicate is deleted.

  • Do other players receive it ok? – Gyan Dec 4 '18 at 17:55
  • Wohoo! You were totally on the right track. I tried SMPlayer and PotPlayer (What a name) and PotPlayer could play it! The question remains: Why doesn't VLC? – GerbGerb Dec 4 '18 at 20:16
  • I'll look into it tomorrow. – Gyan Dec 4 '18 at 20:39
  • Update: I tried also with OpenCV(Python3)'s VideoCapture. This produces a highly corrupted image and a ton of "error while decoding". Could it be that VLC and OpenCV use the same decoder, which has problems with h.264? – GerbGerb Dec 6 '18 at 10:05
  • Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player. – Gyan Dec 6 '18 at 11:10
1

While the underlying issue has not been resolved, @Gyans hints helped me to solve my problem. Using other players (PotPlayer) or an older version of VLC got the stream display to work, and that is all I needed.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.