Embed timestamp in video file using ffmpeg











up vote
0
down vote

favorite












I'm trying to record a video from the webcam using ffmpeg, while saving the exact timestamp in the video format so that I can later match it with other recorded videos:



ffmpeg -f v4l2 -ts abs -video_size 1280x720 -i /dev/video0 -copyts ts_test.mkv


This however seems to mess up the duration of the video. Using ffprobe:



$ ffprobe ts_test.mkv                                                           
...
Input #0, matroska,webm, from 'ts_test.mkv':
Metadata:
ENCODER : Lavf56.40.101
Duration: 428390:10:05.90, start: 1542204570.100000, bitrate: N/A
Stream #0:0: Video: h264 (High 4:2:2), yuv422p, 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 20 tbc (default)
Metadata:
ENCODER : Lavc56.60.100 libx264
DURATION : 428390:10:05.900000


So, although the start time is listed as the current epoch, the duration is now also set to the time passed since 1970 (~428390 hours), which obviously messes with most video players.



What is the correct way to record the timestamp using ffmpeg?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm trying to record a video from the webcam using ffmpeg, while saving the exact timestamp in the video format so that I can later match it with other recorded videos:



    ffmpeg -f v4l2 -ts abs -video_size 1280x720 -i /dev/video0 -copyts ts_test.mkv


    This however seems to mess up the duration of the video. Using ffprobe:



    $ ffprobe ts_test.mkv                                                           
    ...
    Input #0, matroska,webm, from 'ts_test.mkv':
    Metadata:
    ENCODER : Lavf56.40.101
    Duration: 428390:10:05.90, start: 1542204570.100000, bitrate: N/A
    Stream #0:0: Video: h264 (High 4:2:2), yuv422p, 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 20 tbc (default)
    Metadata:
    ENCODER : Lavc56.60.100 libx264
    DURATION : 428390:10:05.900000


    So, although the start time is listed as the current epoch, the duration is now also set to the time passed since 1970 (~428390 hours), which obviously messes with most video players.



    What is the correct way to record the timestamp using ffmpeg?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to record a video from the webcam using ffmpeg, while saving the exact timestamp in the video format so that I can later match it with other recorded videos:



      ffmpeg -f v4l2 -ts abs -video_size 1280x720 -i /dev/video0 -copyts ts_test.mkv


      This however seems to mess up the duration of the video. Using ffprobe:



      $ ffprobe ts_test.mkv                                                           
      ...
      Input #0, matroska,webm, from 'ts_test.mkv':
      Metadata:
      ENCODER : Lavf56.40.101
      Duration: 428390:10:05.90, start: 1542204570.100000, bitrate: N/A
      Stream #0:0: Video: h264 (High 4:2:2), yuv422p, 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 20 tbc (default)
      Metadata:
      ENCODER : Lavc56.60.100 libx264
      DURATION : 428390:10:05.900000


      So, although the start time is listed as the current epoch, the duration is now also set to the time passed since 1970 (~428390 hours), which obviously messes with most video players.



      What is the correct way to record the timestamp using ffmpeg?










      share|improve this question













      I'm trying to record a video from the webcam using ffmpeg, while saving the exact timestamp in the video format so that I can later match it with other recorded videos:



      ffmpeg -f v4l2 -ts abs -video_size 1280x720 -i /dev/video0 -copyts ts_test.mkv


      This however seems to mess up the duration of the video. Using ffprobe:



      $ ffprobe ts_test.mkv                                                           
      ...
      Input #0, matroska,webm, from 'ts_test.mkv':
      Metadata:
      ENCODER : Lavf56.40.101
      Duration: 428390:10:05.90, start: 1542204570.100000, bitrate: N/A
      Stream #0:0: Video: h264 (High 4:2:2), yuv422p, 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 20 tbc (default)
      Metadata:
      ENCODER : Lavc56.60.100 libx264
      DURATION : 428390:10:05.900000


      So, although the start time is listed as the current epoch, the duration is now also set to the time passed since 1970 (~428390 hours), which obviously messes with most video players.



      What is the correct way to record the timestamp using ffmpeg?







      video ffmpeg webcam timestamp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 at 14:20









      nbubis

      1086




      1086



























          active

          oldest

          votes











          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%2f1375338%2fembed-timestamp-in-video-file-using-ffmpeg%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375338%2fembed-timestamp-in-video-file-using-ffmpeg%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

          Сан-Квентин

          Алькесар

          Josef Freinademetz