I am trying to combine a set of approximately 40 videos into a single file with as little re-encoding as possible. Most of these videos are from the same source (an Elgato capture card), but 4 clips are from a different source and therefore have different video stream properties such as video codec, aspect ratio, frame rate, etc. (these clips are meant to signify scene transitions in the final file, so I will refer to them as the transition clips) I have made copies of the transition clips that are just the raw AV data (pcm for audio and an x264 video stream with 0 crf and keyframe interval) in an .mov container. After doing that, I transcoded the raw files using settings that match those of the video clips coming from the capture card. So the result is that I have all 40 videos in the same container format with the same audio and the same video settings (although I noticed something peculiar about the capture card clips which I'll point out when I get to ffmpeg's output), meaning concatinating them should be no issue. After all the files have been combined, I tested playback using MPC-HC and VLC and while I do recieve video for the clips coming from the capture card, no video appears for the transition clips. I eventually found that the issue is present even when combining only two capture card clips and a transition clip between them, and since that's easier to deal with than a single 5 hour video and the 40 videos making it up, those are what I will be providing.

   DL for video clips (and ffmpeg's report when merging):
   https://mega.nz/#F!EV1j2KYK!Rfyj9uhCltqfXU6b_pRP2w
   06.mp4 & 07.mp4 - Clips originating from the capture card
   20mins.mp4 - The transition clip
   out.mp4 - The file generated from ffmpeg
   This is the command I ran to merge the files:
   ffmpeg -report -f concat -i "New Text Document.txt" -c:v copy -c:a
   copy out.mp4

Below is ffmpeg's output on the metadata of each clip when they're passed as input

   D:\home\Desktop\vidstuff\New folder\tst>ffmpeg -i 06.mp4 -i 07.mp4
   -i 20mins.mp4

   ffmpeg version N-79209-gb3eda69 Copyright (c) 2000-2016 the FFmpeg
   developers
      built with gcc 5.3.0 (GCC)
                ...
   Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '06.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        title           : Stealth Who?
        date            : 2014-07-05
        encoder         : Lavf57.29.101
      Duration: 00:00:07.20, start: 0.142159, bitrate: 6055 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661),
   yuv420p(tv, smpte1
   70m/smpte170m/bt709), 720x480 [SAR 40:33 DAR 20:11], 5888 kb/s, SAR
   32:27 DAR 16
   :9, 59.94 fps, 59.94 tbr, 59940 tbn, 119.88 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000
   Hz, stereo, flt
   p, 219 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
   Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '07.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        title           : Stealth Who?
        date            : 2014-07-05
        encoder         : Lavf57.29.101
      Duration: 00:00:05.31, start: 0.245245, bitrate: 6363 kb/s
        Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661),
   yuv420p(tv, smpte1
   70m/smpte170m/bt709), 720x480 [SAR 40:33 DAR 20:11], 6135 kb/s, SAR
   32:27 DAR 16
   :9, 59.94 fps, 59.94 tbr, 59940 tbn, 119.88 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000
   Hz, stereo, flt
   p, 221 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
   Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '20mins.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.29.101
      Duration: 00:00:01.92, start: 0.000000, bitrate: 554 kb/s
        Stream #2:0(eng): Video: h264 (High) (avc1 / 0x31637661),
   yuv420p, 720x480 [
   SAR 32:27 DAR 16:9], 407 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn,
   119.88 tbc (defa
   ult)
        Metadata:
          handler_name    : VideoHandler
        Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000
   Hz, stereo, flt
   p, 133 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
   At least one output file must be specified

This is the command I used to transcode the transition clip from the raw mov format to mp4

   ffmpeg -ss 2.6 -i RAW20mins.mov -filter:v
   "scale=w=720:h=480,setsar=32:27" -r 59.94 -t 1.9 -r 59.94 "20mins.mp4"

What's interesting is that for both capture card clips, ffmpeg reports two different SAR & DAR pairs for one video stream. Am I correct in assuming the first pair (in the square brackets) are just inferred values that aren't actually found within the input file?

   Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '06.mp4':
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661),
   yuv420p(tv, smpte1
   70m/smpte170m/bt709), 720x480 [SAR 40:33 DAR 20:11], 5888 kb/s, SAR
   32:27 DAR 16
   :9, 59.94 fps, 59.94 tbr, 59940 tbn, 119.88 tbc (default)
                ...
   Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '07.mp4':
        Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661),
   yuv420p(tv, smpte1
   70m/smpte170m/bt709), 720x480 [SAR 40:33 DAR 20:11], 6135 kb/s, SAR
   32:27 DAR 16
   :9, 59.94 fps, 59.94 tbr, 59940 tbn, 119.88 tbc (default)

I have tried using the concat _filter_ instead of the demuxer to generate the final file and originally I generated the transcition clip using the first SAR (40:33). This however generated the following error:

   D:\home\Desktop\vidstuff\New folder\tst\New folder>ffmpeg -i 06.mp4
   -i 20mins.mp
   4 -i 07.mp4 -filter_complex
   "[0:0][0:1][1:0][1:1][2:0][2:1]concat=n=3:v=1:a=1[v]
   [a]" -map "[v]" -map "[a]" out.mp4
                ....
   [Parsed_concat_0 @ 0000000002a43640] Input link in1:v0 parameters
   (size 720x480,
     SAR 40:33) do not match the corresponding output link in0:v0
   parameters (720x48
   0, SAR 32:27)
   [Parsed_concat_0 @ 0000000002a43640] Failed to configure output pad
   on Parsed_co
   ncat_0
   Error configuring complex filters.
   Invalid argument

When I generated the transition clip using the second SAR (32:27), there was no such error and ffmpeg went on it's merry way generating the final file.

Using the concat filter as I have described above results in a file that /does/ display video during playback, including the transition clips, meaning it is a workaround for the issue at hand. However, since this will trigger a re-encoding of the entire video stream, I only want to use that as a last resort (and also because I am curious about what is causing the issue during playback).

P.S. I am on a windows 7 computer using a windows build of ffmpeg

P.S.S. I just noticed during the writing of this that if I seek directly to the transition clip portion of the final video during playback, the video will appear (this happens for MPC-HC, but not for VLC). It is only during normal, uninterrupted playback that the video does not appear. I'm just spitballing here, but can I force ffmpeg to set a keyframe in the final file at the points matching up with the start of each input video stream?
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to