Variable framerate lossless video from yuv422 images












0















I've been pulling my hair lately with FFmpeg commandline. Be aware that I am not an FFmpeg expert. Here is my problem:



I have a bunch of YUV422 images as such:



image0.yuv
image1.yuv
..
image450.yuv


Along with these I have a file containing timestamps for every image, say:



timestamps.txt


I would like to encode a lossless video (maybe with -c:v libx264 -pix_fmt yuv422p) from these with every image displayed at its correct timstamp. Here are the things I tried in vain:





  • use -f concat and provide a file containing a list like this:



    file 'image0.yuv'
    duration '0.0515'
    file 'image0.yuv'
    duration '0.0721'
    ... etc


    this solution does not work because I need to provide a frame size (which is not included in the raw yuv files)



  • something like cat *.yuv | ffmpeg -f rawvideo -s 800x600 -pix_fmt yuv422p -framerate 0.5 -i - -c:v libx264 -pix_fmt yuv422p out.mp4 which doesn't work neither because I can't provide it timestamps for each image (variable framerate) but just use the fixed -framerate argument


  • I'm aware of the -vsync vfr argument but can't manage to make it work properly



I would be eternally grateful for any piece of advice, thanks :)










share|improve this question























  • See video.stackexchange.com/a/19726

    – Gyan
    Jan 14 at 15:51


















0















I've been pulling my hair lately with FFmpeg commandline. Be aware that I am not an FFmpeg expert. Here is my problem:



I have a bunch of YUV422 images as such:



image0.yuv
image1.yuv
..
image450.yuv


Along with these I have a file containing timestamps for every image, say:



timestamps.txt


I would like to encode a lossless video (maybe with -c:v libx264 -pix_fmt yuv422p) from these with every image displayed at its correct timstamp. Here are the things I tried in vain:





  • use -f concat and provide a file containing a list like this:



    file 'image0.yuv'
    duration '0.0515'
    file 'image0.yuv'
    duration '0.0721'
    ... etc


    this solution does not work because I need to provide a frame size (which is not included in the raw yuv files)



  • something like cat *.yuv | ffmpeg -f rawvideo -s 800x600 -pix_fmt yuv422p -framerate 0.5 -i - -c:v libx264 -pix_fmt yuv422p out.mp4 which doesn't work neither because I can't provide it timestamps for each image (variable framerate) but just use the fixed -framerate argument


  • I'm aware of the -vsync vfr argument but can't manage to make it work properly



I would be eternally grateful for any piece of advice, thanks :)










share|improve this question























  • See video.stackexchange.com/a/19726

    – Gyan
    Jan 14 at 15:51
















0












0








0








I've been pulling my hair lately with FFmpeg commandline. Be aware that I am not an FFmpeg expert. Here is my problem:



I have a bunch of YUV422 images as such:



image0.yuv
image1.yuv
..
image450.yuv


Along with these I have a file containing timestamps for every image, say:



timestamps.txt


I would like to encode a lossless video (maybe with -c:v libx264 -pix_fmt yuv422p) from these with every image displayed at its correct timstamp. Here are the things I tried in vain:





  • use -f concat and provide a file containing a list like this:



    file 'image0.yuv'
    duration '0.0515'
    file 'image0.yuv'
    duration '0.0721'
    ... etc


    this solution does not work because I need to provide a frame size (which is not included in the raw yuv files)



  • something like cat *.yuv | ffmpeg -f rawvideo -s 800x600 -pix_fmt yuv422p -framerate 0.5 -i - -c:v libx264 -pix_fmt yuv422p out.mp4 which doesn't work neither because I can't provide it timestamps for each image (variable framerate) but just use the fixed -framerate argument


  • I'm aware of the -vsync vfr argument but can't manage to make it work properly



I would be eternally grateful for any piece of advice, thanks :)










share|improve this question














I've been pulling my hair lately with FFmpeg commandline. Be aware that I am not an FFmpeg expert. Here is my problem:



I have a bunch of YUV422 images as such:



image0.yuv
image1.yuv
..
image450.yuv


Along with these I have a file containing timestamps for every image, say:



timestamps.txt


I would like to encode a lossless video (maybe with -c:v libx264 -pix_fmt yuv422p) from these with every image displayed at its correct timstamp. Here are the things I tried in vain:





  • use -f concat and provide a file containing a list like this:



    file 'image0.yuv'
    duration '0.0515'
    file 'image0.yuv'
    duration '0.0721'
    ... etc


    this solution does not work because I need to provide a frame size (which is not included in the raw yuv files)



  • something like cat *.yuv | ffmpeg -f rawvideo -s 800x600 -pix_fmt yuv422p -framerate 0.5 -i - -c:v libx264 -pix_fmt yuv422p out.mp4 which doesn't work neither because I can't provide it timestamps for each image (variable framerate) but just use the fixed -framerate argument


  • I'm aware of the -vsync vfr argument but can't manage to make it work properly



I would be eternally grateful for any piece of advice, thanks :)







command-line video ffmpeg framerate lossless






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 14 at 15:38









Robin BeilvertRobin Beilvert

31




31













  • See video.stackexchange.com/a/19726

    – Gyan
    Jan 14 at 15:51





















  • See video.stackexchange.com/a/19726

    – Gyan
    Jan 14 at 15:51



















See video.stackexchange.com/a/19726

– Gyan
Jan 14 at 15:51







See video.stackexchange.com/a/19726

– Gyan
Jan 14 at 15:51












1 Answer
1






active

oldest

votes


















1














It's not possible to specify common input options for the concat demuxer. Quick and dirty workaround: convert all YUV images to something that can be read without having to specify further options. For example:



for f in *.yuv; do ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i "$f" "${f%%.yuv}.avi"; done


Then, construct your concat file with the AVI files instead.



Or, with GNU parallel:



parallel 'ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i {} {.}.avi' ::: *.yuv


Or use the method linked to in the comments wherein you can pipe the YUV images and later modify the CFR timestamps of the generated file to become VFR.






share|improve this answer























    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',
    autoActivateHeartbeat: false,
    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%2f1394160%2fvariable-framerate-lossless-video-from-yuv422-images%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









    1














    It's not possible to specify common input options for the concat demuxer. Quick and dirty workaround: convert all YUV images to something that can be read without having to specify further options. For example:



    for f in *.yuv; do ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i "$f" "${f%%.yuv}.avi"; done


    Then, construct your concat file with the AVI files instead.



    Or, with GNU parallel:



    parallel 'ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i {} {.}.avi' ::: *.yuv


    Or use the method linked to in the comments wherein you can pipe the YUV images and later modify the CFR timestamps of the generated file to become VFR.






    share|improve this answer




























      1














      It's not possible to specify common input options for the concat demuxer. Quick and dirty workaround: convert all YUV images to something that can be read without having to specify further options. For example:



      for f in *.yuv; do ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i "$f" "${f%%.yuv}.avi"; done


      Then, construct your concat file with the AVI files instead.



      Or, with GNU parallel:



      parallel 'ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i {} {.}.avi' ::: *.yuv


      Or use the method linked to in the comments wherein you can pipe the YUV images and later modify the CFR timestamps of the generated file to become VFR.






      share|improve this answer


























        1












        1








        1







        It's not possible to specify common input options for the concat demuxer. Quick and dirty workaround: convert all YUV images to something that can be read without having to specify further options. For example:



        for f in *.yuv; do ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i "$f" "${f%%.yuv}.avi"; done


        Then, construct your concat file with the AVI files instead.



        Or, with GNU parallel:



        parallel 'ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i {} {.}.avi' ::: *.yuv


        Or use the method linked to in the comments wherein you can pipe the YUV images and later modify the CFR timestamps of the generated file to become VFR.






        share|improve this answer













        It's not possible to specify common input options for the concat demuxer. Quick and dirty workaround: convert all YUV images to something that can be read without having to specify further options. For example:



        for f in *.yuv; do ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i "$f" "${f%%.yuv}.avi"; done


        Then, construct your concat file with the AVI files instead.



        Or, with GNU parallel:



        parallel 'ffmpeg -f rawvideo -s 320x240 -pix_fmt yuv422p -i {} {.}.avi' ::: *.yuv


        Or use the method linked to in the comments wherein you can pipe the YUV images and later modify the CFR timestamps of the generated file to become VFR.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 14 at 15:52









        slhckslhck

        161k47447470




        161k47447470






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394160%2fvariable-framerate-lossless-video-from-yuv422-images%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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy