VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Hi,

    If for example, we take one video that has a frame rate of 25 and another with 29.970 FPS and merge them using FFmpeg (without re-encoding because both videos are encoded with the same codec), does the merged video have a variable frame rate or does it use the frame rate of the first video for everything? Because if we check with MediaInfo it shows that the frame rate mode is constant and that it's using the frame rate of the first video of the videos merged, but I don't understand how that's possible without re-encoding to change the frame rate.
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Post your complete FFmpeg command line
    Quote Quote  
  3. Originally Posted by davexnet View Post
    Post your complete FFmpeg command line
    I don't know how to concat files directly so I made a list and ran the concat command:

    Code:
    ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv
    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.1 (GCC) 20190807
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
      libavutil      56. 31.100 / 56. 31.100
      libavcodec     58. 54.100 / 58. 54.100
      libavformat    58. 29.100 / 58. 29.100
      libavdevice    58.  8.100 / 58.  8.100
      libavfilter     7. 57.100 /  7. 57.100
      libswscale      5.  5.100 /  5.  5.100
      libswresample   3.  5.100 /  3.  5.100
      libpostproc    55.  5.100 / 55.  5.100
    Input #0, concat, from 'mylist.txt':
      Duration: N/A, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc
        Metadata:
          DURATION        : 00:11:22.880000000
        Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp
        Metadata:
          title           : Stereo
          DURATION        : 00:11:22.922000000
    Output #0, matroska, to 'output.mkv':
      Metadata:
        encoder         : Lavf58.29.100
        Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 1k tbc
        Metadata:
          DURATION        : 00:11:22.880000000
        Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp
        Metadata:
          title           : Stereo
          DURATION        : 00:11:22.922000000
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=19409 fps=11687 q=-1.0 Lsize=  481239kB time=00:12:40.94 bitrate=5180.8kbits/s speed= 458x
    video:463829kB audio:17015kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.082112%
    Code:
     ffprobe 1.mkv
    ffprobe version 2020-09-27-git-a3a6b56200-full_build-www.gyan.dev Copyright (c) 2007-2020 the FFmpeg developers
      built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
      configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libwavpack --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
      libavutil      56. 59.100 / 56. 59.100
      libavcodec     58.108.100 / 58.108.100
      libavformat    58. 59.100 / 58. 59.100
      libavdevice    58. 11.102 / 58. 11.102
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
      libpostproc    55.  8.100 / 55.  8.100
    Input #0, matroska,webm, from '1.mkv':
      Metadata:
        creation_time   : 2020-12-30T13:25:14.000000Z
        ENCODER         : Lavf58.29.100
      Duration: 00:11:22.92, start: 0.000000, bitrate: 5137 kb/s
        Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
        Metadata:
          DURATION        : 00:11:22.880000000
        Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
        Metadata:
          title           : Stereo
          DURATION        : 00:11:22.922000000
    
    ffprobe 2.mkv
    ffprobe version 2020-09-27-git-a3a6b56200-full_build-www.gyan.dev Copyright (c) 2007-2020 the FFmpeg developers
      built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
      configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libwavpack --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
      libavutil      56. 59.100 / 56. 59.100
      libavcodec     58.108.100 / 58.108.100
      libavformat    58. 59.100 / 58. 59.100
      libavdevice    58. 11.102 / 58. 11.102
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
      libpostproc    55.  8.100 / 55.  8.100
    Input #0, matroska,webm, from '2.mkv':
      Metadata:
        creation_time   : 2020-11-17T07:38:10.000000Z
        ENCODER         : Lavf58.29.100
      Duration: 00:01:18.04, start: 0.000000, bitrate: 5556 kb/s
        Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 29.97 tbc (default)
        Metadata:
          DURATION        : 00:01:18.044000000
        Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
        Metadata:
          title           : Stereo
          DURATION        : 00:01:18.040000000
    Last edited by Felow; 2nd Jan 2021 at 20:36.
    Quote Quote  
  4. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    It's not variable frame output, looks to me like the 2nd video is either sped up or slowed down to the first frame rate.
    Didn't you observe this yourself?
    Doesn't look like a viable solution to concatenate such dissimilar files (there are other members of this forum much
    more conversant with FFmpeg than myself, so you may get other answers)
    Quote Quote  
  5. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by Felow View Post
    Hi,

    If for example, we take one video that has a frame rate of 25 and another with 29.970 FPS and merge them using FFmpeg (without re-encoding because both videos are encoded with the same codec), does the merged video have a variable frame rate or does it use the frame rate of the first video for everything? Because if we check with MediaInfo it shows that the frame rate mode is constant and that it's using the frame rate of the first video of the videos merged, but I don't understand how that's possible without re-encoding to change the frame rate.
    I don't know how to make ffmpeg do what you want it to do, but this is the "how-to" that I would choose anyway:

    1) extract the elementary streams from clip1 and clip2;
    2) concatenate video1 with video2 and audio1 with audio2 through the olde and goode copy /b;
    3) create a timestamps.txt file in which all the frames from video1 are set to 25fps and all the frames from video2 are set to 29.97fps;
    4) generate the new MKV file from video1+video2, audio1+audio2, and timestamps.txt — I recommend MKVtoolnix instead of ffmpeg for this last step, but only because I'm still a newbie at using ffmpeg...
    Last edited by El Heggunte; 3rd Jan 2021 at 00:28. Reason: grammar
    "Programmers are human-shaped machines that transform alcohol into bugs."
    Quote Quote  
  6. Originally Posted by davexnet View Post
    It's not variable frame output, looks to me like the 2nd video is either sped up or slowed down to the first frame rate.
    Didn't you observe this yourself?
    Doesn't look like a viable solution to concatenate such dissimilar files (there are other members of this forum much
    more conversant with FFmpeg than myself, so you may get other answers)
    I've been concatenating videos this way for a long time and haven't found any problems and to be honest I don't notice a difference going from 30 to 25 fps or the other way around.

    Edit: An FFmpeg maintainer told me: "If your inputs are MKV/WebM, then each video will be played at its native speed." Although I don't know the reason why Mediainfo doesn't say that the merged video has a variable frame rate, I got my answer.

    Thanks.
    Last edited by Felow; 3rd Jan 2021 at 10:50.
    Quote Quote  
  7. why Mediainfo doesn't say that the merged video has a variable frame rate, I got my answer.
    MediaInfo only looks at a few time codes at the start of the video and doesn't look at all the time codes of the inputs, otherwise it would be way slower.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!