Using ffmpeg to copy metadata from one file to another












11















I want to use ffmpeg to copy all meta data not associated with core aspects of a video (frame rate, resolution) from one video to another. Is there a simple way to do this with a single command?










share|improve this question



























    11















    I want to use ffmpeg to copy all meta data not associated with core aspects of a video (frame rate, resolution) from one video to another. Is there a simple way to do this with a single command?










    share|improve this question

























      11












      11








      11


      2






      I want to use ffmpeg to copy all meta data not associated with core aspects of a video (frame rate, resolution) from one video to another. Is there a simple way to do this with a single command?










      share|improve this question














      I want to use ffmpeg to copy all meta data not associated with core aspects of a video (frame rate, resolution) from one video to another. Is there a simple way to do this with a single command?







      ffmpeg metadata






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '15 at 2:53









      DavidDavid

      180126




      180126






















          2 Answers
          2






          active

          oldest

          votes


















          13














          Use -map_metadata.



          In this example the global and stream metadata will be copied from in0.mkv. The video and audio streams will be stream copied from in1.mkv:



          ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy 
          # copies all global metadata from in0.mkv to out.mkv
          -map_metadata 0
          # copies video stream metadata from in0.mkv to out.mkv
          -map_metadata:s:v 0:s:v
          # copies audio stream metadata from in0.mkv to out.mkv
          -map_metadata:s:a 0:s:a
          out.mkv


          This will result in something like:



          Output #0, matroska, to 'out.mkv':
          Metadata:
          title : Global Title
          AUTHOR : Global Author
          Stream #0:0: Video: h264
          Metadata:
          title : Stream 0 Title
          Stream #0:1: Audio: vorbis
          Metadata:
          title : Stream 1 Title


          By default global metadata is copied from the first input file, so -map_metadata 0 could probably be omitted.






          share|improve this answer































            -2














            If all you need is the basics (creation date, etc), then
            touch -r FILE1 FILE2
            Will work as a charm coping metadata from FILE1 to FILE2






            share|improve this answer
























            • If you read the question, the objective is the video meta data, not the file meta data.

              – fixer1234
              Oct 27 '16 at 20:39











            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%2f996223%2fusing-ffmpeg-to-copy-metadata-from-one-file-to-another%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            13














            Use -map_metadata.



            In this example the global and stream metadata will be copied from in0.mkv. The video and audio streams will be stream copied from in1.mkv:



            ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy 
            # copies all global metadata from in0.mkv to out.mkv
            -map_metadata 0
            # copies video stream metadata from in0.mkv to out.mkv
            -map_metadata:s:v 0:s:v
            # copies audio stream metadata from in0.mkv to out.mkv
            -map_metadata:s:a 0:s:a
            out.mkv


            This will result in something like:



            Output #0, matroska, to 'out.mkv':
            Metadata:
            title : Global Title
            AUTHOR : Global Author
            Stream #0:0: Video: h264
            Metadata:
            title : Stream 0 Title
            Stream #0:1: Audio: vorbis
            Metadata:
            title : Stream 1 Title


            By default global metadata is copied from the first input file, so -map_metadata 0 could probably be omitted.






            share|improve this answer




























              13














              Use -map_metadata.



              In this example the global and stream metadata will be copied from in0.mkv. The video and audio streams will be stream copied from in1.mkv:



              ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy 
              # copies all global metadata from in0.mkv to out.mkv
              -map_metadata 0
              # copies video stream metadata from in0.mkv to out.mkv
              -map_metadata:s:v 0:s:v
              # copies audio stream metadata from in0.mkv to out.mkv
              -map_metadata:s:a 0:s:a
              out.mkv


              This will result in something like:



              Output #0, matroska, to 'out.mkv':
              Metadata:
              title : Global Title
              AUTHOR : Global Author
              Stream #0:0: Video: h264
              Metadata:
              title : Stream 0 Title
              Stream #0:1: Audio: vorbis
              Metadata:
              title : Stream 1 Title


              By default global metadata is copied from the first input file, so -map_metadata 0 could probably be omitted.






              share|improve this answer


























                13












                13








                13







                Use -map_metadata.



                In this example the global and stream metadata will be copied from in0.mkv. The video and audio streams will be stream copied from in1.mkv:



                ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy 
                # copies all global metadata from in0.mkv to out.mkv
                -map_metadata 0
                # copies video stream metadata from in0.mkv to out.mkv
                -map_metadata:s:v 0:s:v
                # copies audio stream metadata from in0.mkv to out.mkv
                -map_metadata:s:a 0:s:a
                out.mkv


                This will result in something like:



                Output #0, matroska, to 'out.mkv':
                Metadata:
                title : Global Title
                AUTHOR : Global Author
                Stream #0:0: Video: h264
                Metadata:
                title : Stream 0 Title
                Stream #0:1: Audio: vorbis
                Metadata:
                title : Stream 1 Title


                By default global metadata is copied from the first input file, so -map_metadata 0 could probably be omitted.






                share|improve this answer













                Use -map_metadata.



                In this example the global and stream metadata will be copied from in0.mkv. The video and audio streams will be stream copied from in1.mkv:



                ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy 
                # copies all global metadata from in0.mkv to out.mkv
                -map_metadata 0
                # copies video stream metadata from in0.mkv to out.mkv
                -map_metadata:s:v 0:s:v
                # copies audio stream metadata from in0.mkv to out.mkv
                -map_metadata:s:a 0:s:a
                out.mkv


                This will result in something like:



                Output #0, matroska, to 'out.mkv':
                Metadata:
                title : Global Title
                AUTHOR : Global Author
                Stream #0:0: Video: h264
                Metadata:
                title : Stream 0 Title
                Stream #0:1: Audio: vorbis
                Metadata:
                title : Stream 1 Title


                By default global metadata is copied from the first input file, so -map_metadata 0 could probably be omitted.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 5 '15 at 6:27









                lloganllogan

                25.4k54679




                25.4k54679

























                    -2














                    If all you need is the basics (creation date, etc), then
                    touch -r FILE1 FILE2
                    Will work as a charm coping metadata from FILE1 to FILE2






                    share|improve this answer
























                    • If you read the question, the objective is the video meta data, not the file meta data.

                      – fixer1234
                      Oct 27 '16 at 20:39
















                    -2














                    If all you need is the basics (creation date, etc), then
                    touch -r FILE1 FILE2
                    Will work as a charm coping metadata from FILE1 to FILE2






                    share|improve this answer
























                    • If you read the question, the objective is the video meta data, not the file meta data.

                      – fixer1234
                      Oct 27 '16 at 20:39














                    -2












                    -2








                    -2







                    If all you need is the basics (creation date, etc), then
                    touch -r FILE1 FILE2
                    Will work as a charm coping metadata from FILE1 to FILE2






                    share|improve this answer













                    If all you need is the basics (creation date, etc), then
                    touch -r FILE1 FILE2
                    Will work as a charm coping metadata from FILE1 to FILE2







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 27 '16 at 20:12









                    EmilianoEmiliano

                    1




                    1













                    • If you read the question, the objective is the video meta data, not the file meta data.

                      – fixer1234
                      Oct 27 '16 at 20:39



















                    • If you read the question, the objective is the video meta data, not the file meta data.

                      – fixer1234
                      Oct 27 '16 at 20:39

















                    If you read the question, the objective is the video meta data, not the file meta data.

                    – fixer1234
                    Oct 27 '16 at 20:39





                    If you read the question, the objective is the video meta data, not the file meta data.

                    – fixer1234
                    Oct 27 '16 at 20:39


















                    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%2f996223%2fusing-ffmpeg-to-copy-metadata-from-one-file-to-another%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

                    Сан-Квентин

                    8-я гвардейская общевойсковая армия

                    Алькесар