Combine 2 .FLV videos

2019-09-05 16:54发布

问题:

For the last 4 hours I've been trying to combine 2 .flv files into one using ffmpeg (or well, just C# in general).

Here's what I got so far: I've converted both the videos to .mp4 videos:

"-i " + videoFileLocation + " -c copy -copyts " + newConvertedFileLocation

I have then combined the two .mp4 files into a single one using: (txtPath is the text file with the two mp4 file locations)

"-f concat -i " + txtPath + " -c copy " + saveLocation

This ends up with an mp4 file which contains the combination of both the videos BUT with the following fault:

The length of the first video is 0:05

The length of the second video is 6:11

However the length of the combined video is for some reason 07:51 - thus the video runs at a slower pace than it should.

Furthermore the audio is async with the video.

What am I doing wrong here?

I haven't used ffmpeg before and I just wanna get this working.

Any help is greatly appreciated!

As requested here is the output from running 'ffmpeg -i input1.flv -i input2.flv':

ffmpeg version 2.7 Copyright (c) 2000-2015 the FFmpeg developers   built with gcc 4.9.2 (GCC)...

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filepath\input1.flv':   Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.24.2   Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler Input #1, flv, from 'filepath\input2.flv':   Metadata:
    audiosize       : 4476626
    canSeekToEnd    : true
    datasize        : 23876671
    videosize       : 19004263
    hasAudio        : true
    hasCuePoints    : false
    hasKeyframes    : true
    hasMetadata     : true
    hasVideo        : true
    lasttimestamp   : 372
    metadatacreator : flvtool++ (Facebook, Motion project, dweatherford)
    totalframes     : 9298
    encoder         : Lavf56.36.100   Duration: 00:06:11.92, start: 0.080000, bitrate: 513 kb/s
    Stream #1:0: Video: h264 (High), yuv420p, 646x364 [SAR 1:1 DAR 323:182], 400 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #1:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 96 kb/s At least one output file must be specified