VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Hi All,

    I am trying to convert some MTS file to either an MP4 or an MKV file. I have ffmpeg installed and used the below command to convert it and it seemed to work.

    Code:
    ffmpeg -i input.mts -c:v copy -c:acopy  output.mp4
    However, I need to keep the original metadata (the date and time stamps in particular). I can't seem to figure out how to do that. I saw that there is a -map_metadata tag in ffmpeg but I couldn't get it to work.

    Any ideas or suggestions? I have exiftool installed too if there is a way I could use that to make it work.
    Quote Quote  
  2. Try
    -map_metadata 0 -metadata creation_time=now

    Basically you can extract the metadata from your source like
    ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE

    Remux the (edited) FFMETADATAFILE like
    ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
    Last edited by Sharc; 30th Jan 2019 at 07:44.
    Quote Quote  
  3. Originally Posted by Sharc View Post
    Try
    -map_metadata 0 -metadata creation_time=now

    Basically you can extract the metadata from your source like
    ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE

    Remux the (edited) FFMETADATAFILE like
    ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
    So I tried this and it worked as far as file goes but date and time stamps didn't get applied to the new file. They show the current date/time instead of the date/time from the input file.

    I checked the metadata file and it only has the following lines:

    Code:
    ;FFMETADATA1
    encoder=Lavf58.25.100
    I did get a message when I ran the first command saying "Output file is empty, nothing was encoded" but I assumed that was because I wasn't outputting a video file. Could that be the issue.

    This is the exact command I ran: ffmpeg -i testfile.mts -f ffmetadata testmetadata.txt followed by ffmpeg -i testfile.mts -i testmetadata.txt -map_metadata 1 -codec copy Test.mp4
    Last edited by Yenna; 30th Jan 2019 at 17:24.
    Quote Quote  
  4. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    I have few mts files but found one that had general meta data of encoded. I used your script (putting space in -c:a copy) and produced an MP4 that still retained the meta data when checked with MediaInfo..

    Image
    [Attachment 47958 - Click to enlarge]


    If you are looking to copy that to the created/modified dates in Windows, use my program ' change date time' https://www.videohelp.com/software/Change-Date-Time-Batch
    Quote Quote  
  5. [QUOTE=Budman1;2541619]I have few mts files but found one that had general meta data of encoded. I used your script (putting space in -c:a copy) and produced an MP4 that still retained the meta data when checked with MediaInfo..{/QUOTE]

    Looks like you are correct. I was relying on Windows Explorer with the Date Taken, Date Created and Date Modified fields but they were not showing the right information for videos.

    This also helped me find a bug with Google Photos too. That was also tripping me up.

    https://productforums.google.com/forum/#!topic/photos/Bd4d74vy1lw;context-place=topicsearchin/photos/video$20date

    https://productforums.google.com/forum/#!topic/photos/oj96JZK14Fs;context-place=topicsearchin/photos/video$20date

    I should've checked it more thoroughly. Thanks!

    Also what did you mean by this "putting space in -c:a copy"?

    Originally Posted by Budman1 View Post

    If you are looking to copy that to the created/modified dates in Windows, use my program ' change date time' https://www.videohelp.com/software/Change-Date-Time-Batch
    Do you have a guide for this by chance? The link on the page goes to YouTube but videos that show up are for your program.
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Also what did you mean by this "putting space in -c:a copy"?
    Your initial script says -c:acopy. It should be -c:a copy with a space.

    I do not have a guide for my program yet so I better work on that. Basically you pick which direction you want to go, (Metadata -> windows dates OR Windows dates -> Metadata). Then select your source. In the case of Metadata, there is a General, Video and Audio area that usually contains this data as seen using MediaInfo.

    In the case of Windows dates, there is created and and modified. If you check modified it will override created even if both are checked.

    My latest version changes the labels and available drop down boxes as needed only. Follow the labels. If you want to keep the same name, choose separate folders (from/To)
    Keep as is means do not change to correct UTC time (Used by Encoded) or local time used by Windows. If you choose this, be aware encoded is usually UTC time and Windows Created is in local time with the hours offset. They are not identical but some people wanted them to be.
    Quote Quote  
  7. Thanks Budman1. I am going to give it a try and let you know if I have any further questions.
    Quote Quote  



Similar Threads