How to concat MTS videos and apply filters without re-encoding using FFmpeg?

462 views Asked by At

I have a txt file with many MTS video files. I want to merge them all together using FFmpeg and get one big MTS file. But I want to apply fade-in and fade-out to the final video. Can I do it without re-encoding? Because re-encoding takes a lot of time, but I need to do it fast.

Edit

Here is the output when I run

ffmpeg -i C:/Users/aleks/Downloads/IMPORTANT/MTS_videos/my.MTS

Output:

Input #0, mpegts, from 'C:/Users/aleks/Downloads/IMPORTANT/MTS_videos/my.MTS':
  Duration: 00:00:08.51, start: 1.433367, bitrate: 5275 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080, 59.94 fps, 59.94 tbr, 90k tbn, 120k tbc

Edit 2

ok, I think I figured it out. The problem was in audio codec, I added -c:a mp3 and it seems to be working. However now I have the second problem. I have 3 videos. I apply fade in to the first one, fade out to the third one and nothing to the second one. I get them from one video by slicing using this command 3 times

ffmpeg -i 'C:/Users/aleks/Downloads/video.MTS' -ss 20 -t 5 -c copy 'C:/Users/aleks/Downloads/third.MTS'

But when I run it my video is 2 seconds long (it must be 5 seconds long). Can you help me with fixing this problem.

PS. i have seen similar question and there was a suggestion to add -async 1. It didn't help. And moving -t 5 to the position before -i didn't help as well.

Also if I delete -c copy everything works fine. But I need to keep it because I don't want to re-encode.

0

There are 0 answers