I am surveying on distributed video transcoding with FFmpeg. I have found that there is a good script on https://github.com/nergdron/dve/blob/master/dve.
The script mainly uses the segment
and concatenate
filters of FFmpeg. I want to do a simple test first. However, I can not split the video into segments and then concatenate back to original video (with the same codec). I have tried with the following command:
a. Chunk the video
ffmpeg -fflags +genpts -i Test.avi -map 0 -codec copy -f segment -segment_format avi -v error chunk-%03d.seg
b. Building the chunking list:
#!/bin/bash -e
set -e
echo "ffconcat version 1.0" > concat.txt
for f in `ls chunk-*.seg | sort`; do
echo "file $f" >> concat.txt
done
c. Concatenate the chunks
ffmpeg -y -v error -i concat.txt -f concat -map 0 -c copy -f avi output.avi
Then when I run ffprobe
I get the following message which says it is a non-interleaved AVI:
ffprobe version N-82301-g1bbb18f Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 35.100 / 55. 35.100
libavcodec 57. 66.101 / 57. 66.101
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 66.100 / 6. 66.100
libswscale 4. 3.100 / 4. 3.100
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[avi @ 00000000028e3700] non-interleaved AVI
Input #0, avi, from 'output.avi':
Metadata:
encoder : Lavf57.57.100
Duration: 74:43:47.82, start: 0.000000, bitrate: 17 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 640x368 [SAR 1:1 DAR 40:23], 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 112 kb/s
I have tried a few other things without success. Any help would be greatly appreciated. Thanks in advance!!
The segment muxer, by default, preserves input timestamps. And the way that the concat demuxer works is that it adds the relative timestamp of incoming files to the net duration processed so far. e.g. If first file is 10 seconds, and second file is 5 seconds but with a start time of 10 seconds. Then the first frame of the 2nd file in the output will have a timestamp of 20 seconds. This, I believe, is leading to the AVI warning.
Also keeping in mind that the segment muxer can create the concat list for you, use
ffmpeg -fflags +genpts -i Test.avi -map 0 -c copy -f segment -segment_format avi -segment_list Test.ffcat -reset_timestamps 1 -v error chunk-%03d.seg
and then
ffmpeg -y -v error -i Test.ffcat -map 0 -c copy output.avi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With