У меня есть несколько видеофайлов, которые я хочу объединить, после того как я ускоряю 2-минутный раздел видео (это неинтересные 2 минуты, но ускорение будет в порядке, и не потеряет непрерывность). Когда я пытаюсь объединить отредактированный файл с другими, это терпит неудачу. Вот пример ошибки.
[mp4 @ 0x103b180] Non-monotonous DTS in output stream 0:0; previous: 22228547, current: 7750549; changing to 22228548. This may result in incorrect timestamps in the output file.
Я получаю эту ошибку при выдаче этой команды:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
Я только что выпустил это:
ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 newout8.mp4
И вывод ниже:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'newout8.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:14.68, start: 0.021333, bitrate: 23787 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 23651 kb/s, 29.97 fps, 29.97 tbr, 29967 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
time_base=1/48000
Это один из файлов, с которыми мне нужно слить (concat). Я использовал:
ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out7.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out7.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:04:07.02, start: 0.000000, bitrate: 30106 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
time_base=1/48000
Насколько я понимаю, мне нужно перекодировать короткий клип (newout8.mp4), тогда файлы будут сливаться красиво. Кроме того, ffmpeg выводит файл, но воспроизведение не работает правильно.
* Новый контент ниже *
Вот полный вывод попытки конкатировать:
/New$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'mylist.txt':
Duration: N/A, start: 0.000000, bitrate: 30100 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
File 'output.mp4' already exists. Overwrite ? [y/N] y
[mp4 @ 0xfe2180] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0xfe2180] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29972 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 128 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228206, current: 7409208; changing to 22228207. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228207, current: 7410209; changing to 22228208. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228208, current: 7411210; changing to 22228209. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228209, current: 7412211; changing to 22228210. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228210, current: 7413212; changing to 22228211. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228211, current: 7414213; changing to 22228212. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228212, current: 7415214; changing to 22228213. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228213, current: 7416215; changing to 22228214. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228214, current: 7417216; changing to 22228215. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228215, current: 7418217; changing to 22228216. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228216, current: 7419218; changing to 22228217. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228217, current: 7420219; changing to 22228218. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228218, current: 7421220; changing to 22228219. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228219, current: 7422221; changing to 22228220. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228220, current: 7423222; changing to 22228221. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228221, current: 7424223; changing to 22228222. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228222, current: 7425224; changing to 22228223. This may result in incorrect timestamps in the output file.
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228223, current: 7426225; changing to 22228224. This may result in incorrect timestamps in the output file.
<<< Cut out many lines of errors because body limit of 30,000 charactors prevented me from posting all 70844 characters. >>
[mp4 @ 0xfe2180] Non-monotonous DTS in output stream 0:0; previous: 22228555, current: 7758557; changing to 22228556. This may result in incorrect timestamps in the output file.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xfda560] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0xfe2180] Packet with invalid duration -29667 in stream 0ate=30032.2kbits/s
frame= 9451 fps=412 q=-1.0 Lsize= 1157876kB time=00:05:15.70 bitrate=30045.3kbits/s
video:1152663kB audio:4933kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.024227%
Вот содержимое mylist.txt
#file './out1.mp4'
#file './out2.mp4'
#file './out4.mp4'
#file './out5.mp4'
#file './out6.mp4'
file './out7.mp4'
file './out8speed3.mp4'
file './out9.mp4'
#file './out10.mp4'
Как вы видите выше, Ive сократил количество ошибок, ограничив их объединением 3 файлов, 2 неотредактированных и отредактированного в середине (out8speed3).
Я пытался опубликовать сообщение об ошибке целиком, но его было слишком много для ограничения в 30 000 символов (как отмечено выше).
Вот ffprob для вновь отредактированного (я изменил битрейт аудио на 127k, как и другие файлы, после редактирования клипа, увеличив его с 2 минут до 15 секунд.)
/New$ ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out8speed3.mp4
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out8speed3.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:11.68, start: 0.021333, bitrate: 29167 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 29032 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
time_base=1/48000
Вывод ffprobe для out7.mp4 был ранее указан, ниже вывод для out9.mp4
/New$ ffprobe -select_streams a -show_entries stream=time_base -of compact=p=0 out9.mp4
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out9.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:57.00, start: 0.008000, bitrate: 29959 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30006 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
time_base=1/48000