FFMPEG h.264 stream to VLC from raw YUV444 produces black screen and audio noise











up vote
0
down vote

favorite












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.










share|improve this question






















  • Do other players receive it ok?
    – Gyan
    Dec 4 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 at 20:16












  • I'll look into it tomorrow.
    – Gyan
    Dec 4 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 at 10:05










  • Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
    – Gyan
    Dec 6 at 11:10















up vote
0
down vote

favorite












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.










share|improve this question






















  • Do other players receive it ok?
    – Gyan
    Dec 4 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 at 20:16












  • I'll look into it tomorrow.
    – Gyan
    Dec 4 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 at 10:05










  • Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
    – Gyan
    Dec 6 at 11:10













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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.










share|improve this question













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.







video ffmpeg vlc-media-player streaming h.264






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 4 at 13:06









GerbGerb

11




11












  • Do other players receive it ok?
    – Gyan
    Dec 4 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 at 20:16












  • I'll look into it tomorrow.
    – Gyan
    Dec 4 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 at 10:05










  • Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
    – Gyan
    Dec 6 at 11:10


















  • Do other players receive it ok?
    – Gyan
    Dec 4 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 at 20:16












  • I'll look into it tomorrow.
    – Gyan
    Dec 4 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 at 10:05










  • Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
    – Gyan
    Dec 6 at 11:10
















Do other players receive it ok?
– Gyan
Dec 4 at 17:55




Do other players receive it ok?
– Gyan
Dec 4 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 at 20:16






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 at 20:16














I'll look into it tomorrow.
– Gyan
Dec 4 at 20:39




I'll look into it tomorrow.
– Gyan
Dec 4 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 at 10:05




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 at 10:05












Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
– Gyan
Dec 6 at 11:10




Appears to be related to this: trac.videolan.org/vlc/ticket/21024. Downgrade VLC or use another player.
– Gyan
Dec 6 at 11:10










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










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.






share|improve this answer








New contributor




GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380694%2fffmpeg-h-264-stream-to-vlc-from-raw-yuv444-produces-black-screen-and-audio-noise%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    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.






    share|improve this answer








    New contributor




    GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote



      accepted










      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.






      share|improve this answer








      New contributor




      GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        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.






        share|improve this answer








        New contributor




        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        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.







        share|improve this answer








        New contributor




        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Dec 7 at 18:29









        GerbGerb

        11




        11




        New contributor




        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        GerbGerb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380694%2fffmpeg-h-264-stream-to-vlc-from-raw-yuv444-produces-black-screen-and-audio-noise%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How do I know what Microsoft account the skydrive app is syncing to?

            When does type information flow backwards in C++?

            Grease: Live!