Changes between Version 26 and Version 27 of Concatenate


Ignore:
Timestamp:
Oct 17, 2015, 11:06:08 PM (4 years ago)
Author:
basinilya
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Concatenate

    v26 v27  
    5151for i in {1..10}; do printf "file '%s'\n" input.mkv >> mylist.txt; done
    5252ffmpeg -f concat -i mylist.txt -c copy output.mkv
     53}}}
     54
     55Concatenation becomes troublesome, if next file for concatenation does not exist at the beginning, because decoding won't start until the whole list is read. However, it is possible to refer another list at the end of the current list:
     56
     57{{{
     58#!/bin/bash
     59
     60fn_concat_init() {
     61    echo "fn_concat_init"
     62    concat_pls=`mktemp -u -p . concat.XXXXXXXXXX.txt`
     63    concat_pls="${concat_pls#./}"
     64    echo "concat_pls=${concat_pls:?}"
     65    mkfifo "${concat_pls:?}"
     66    echo
     67}
     68
     69fn_concat_feed() {
     70    echo "fn_concat_feed ${1:?}"
     71    {
     72        >&2 echo "removing ${concat_pls:?}"
     73        rm "${concat_pls:?}"
     74        concat_pls=
     75        >&2 fn_concat_init
     76        echo 'ffconcat version 1.0'
     77        echo "file '${1:?}'"
     78        echo "file '${concat_pls:?}'"
     79    } >"${concat_pls:?}"
     80    echo
     81}
     82
     83fn_concat_end() {
     84    echo "fn_concat_end"
     85    {
     86        >&2 echo "removing ${concat_pls:?}"
     87        rm "${concat_pls:?}"
     88        # not writing header.
     89    } >"${concat_pls:?}"
     90    echo
     91}
     92
     93fn_concat_init
     94
     95echo "launching ffmpeg ... all.mkv"
     96timeout 60s ffmpeg -y -re -loglevel warning -i "${concat_pls:?}" -pix_fmt yuv422p all.mkv &
     97
     98ffplaypid=$!
     99
     100
     101echo "generating some test data..."
     102i=0; for c in red yellow green blue; do
     103    ffmpeg -loglevel warning -y -f lavfi -i testsrc=s=720x576:r=12:d=4 -pix_fmt yuv422p -vf "drawbox=w=50:h=w:t=w:c=${c:?}" test$i.mkv
     104    fn_concat_feed test$i.mkv
     105    ((i++));
     106    echo
     107done
     108echo "done"
     109
     110fn_concat_end
     111
     112wait "${ffplaypid:?}"
     113
     114echo "done encoding all.mkv"
    53115}}}
    54116