3

I have two flac audio files, I need to cut them with different timecodes and then concatenated them using one single command line with ffmpeg. Is there a way to do it? I did something like that but it's not working very well, the timestamps of the outputs file are all messed up (instead of having an output flac beginning from 00:00 I have a file beginning from 59:90!!) Also this command line is insanely slow and it works only on unix system...hope someone could help me

mkfifo temp1 temp2 
ffmpeg -y -i PMM_20170116-1100_1.flac -ss 3590 -t 10 -c copy -acodec copy -f flac temp1 2> /dev/null  & ffmpeg -y -i PMM_20170116-1200_1.flac -ss 0 -t   3590 -c copy -acodec copy -f flac temp2 2> /dev/null & ffmpeg -f flac -i "concat:temp1|temp2" -ac 2 -ar 48000 cutmergetest.flac
MadManMoon
  • 85
  • 9

1 Answers1

2

The fast method:

Create a text file.

file file1.flac
inpoint 3590
outpoint 3600
file file2.flac
inpoint 0
outpoint 3590

Run

ffmpeg -f concat -i list.txt -c copy merged.flac

The slow method:

Run

ffmpeg -ss 3590 -t 10 -i file1.flac -ss 0 -t 3590 -i file2.flac -filter_complex "[0][1]concat=n=2:v=0:a=1" -ac 2 -ar 48000 cutmergetest.flac
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Thanks for the answer, the **slow method** works fine because it decodes and reenconde the output, the first one is still a mess with timecodes (maybe a flac problem??), when i open the merged.flac file it does not start from 00:00 but from 59:50, so it's a problem since I have to create a download service and I need to get the output as fast as I can – MadManMoon Feb 15 '17 at 14:39
  • Looks like, with ffmpeg, you are stuck with the slow method. A FLAC stream has a seektable and when a FLAC is streamcopied, that header is carried over but isn' t altered by ffmpeg. If you package the result in a container like MOV or MKV, their metadata supersedes the FLAC's so the timestamps will be fine, but not in a container which relies on the FLAC bitstream for meradata. – Gyan Feb 15 '17 at 18:40