[FFmpeg-user] Use concat demuxer with input format

Nicolas George george at nsup.org
Mon Jul 17 17:14:18 EEST 2017

L'octidi 28 messidor, an CCXXV, Hans Carlson a écrit :
> "... not implemented yet"?  Does that mean it's currently in the works? Or
> just something that has been considered, but no work has been done?

It was considered, but as far as I know nobody is actively working on

>   $ ffmpeg -f s16le -ac 2 -i 'concat:subfile,,start,5292000,end,47628000,,:file1.raw|subfile,,start,1764000,end,28224000,,:file2.raw' -codec mp3 test.mp3
> To calculate the subfile offset sizes, I multiplied the start/end times by
> 176400 (which is the filesize=[52920320] / duration=[300.001814]).  So, for
> file1.raw, inpoint=30 = (176400 * 30 = 5292000) and outpoint=270 = (176400 *
> 270 = 47628000).

Your ffmpeg command-line has a problem: it does not specify the sample
rate, and thus falls back to whatever default libavformat is using. I
strongly advise against relying on default values in this kind of cases,
always specify the relevant parameters. Only you can know the correct
sample rate.

Once you know it, the octets sizes are easy: duration times number of
samples per second (= sample rate) times number of channels times number
of octets per channel value.

The value you used, 176400, is consistent to libaformat's current
default sample rate for PCM files.

> I previously looked into the concat FILTER, but wasn't sure how to extract a
> section from each file.  I assume you mean "atrim" in my case and not
> "trim".

Indeed. It is one of these filters that exist in both video and audio
variant, with the 'a' prefix for the audio.

> Thanks for the various options.

No problem, glad it solved the issue.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20170717/d5602d51/attachment.sig>

More information about the ffmpeg-user mailing list