FFmpeg: протокол concat дает искаженный вывод и пропускает несколько кадров - PullRequest
0 голосов
/ 10 декабря 2018

Использование:

var command = "-y -i concat:$concatString -c copy -bsf:a aac_adtstoasc $outputFile"

выходное видео пропускает несколько кадров между ними и переходит с 4-й секунды на 6-ю секунду

Если я использую:

var command = "-y -i concat:$concatString -c:v libx264 -preset ultrafast -crf 30 $outputFile"

Тогда,вывод в порядке, но это занимает слишком много времени с предупреждением

[mp4 @ 0xf7228600] Non-monotonous DTS in output stream 0:1

Журналы выглядят так:

2018-12-11 13:27:19.146 7435-7435/com.onedayapp.mystory.dev D/com.onedayapp.mystory.oneday.controllers.service.VideoCompositionService: onProgress ----Merge---- [mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 705608, current: 210096; changing to 705609. This may result in incorrect timestamps in the output file.
2018-12-11 13:27:19.146 7435-7435/com.onedayapp.mystory.dev D/com.onedayapp.mystory.oneday.controllers.service.VideoCompositionService: onProgress ----Merge---- frame=  745 fps=0.0 q=-1.0 Lsize=    1823kB    time=00:03:04.84 bitrate=  80.8kbits/s speed= 758x    
2018-12-11 13:27:19.147 7435-7435/com.onedayapp.mystory.dev D/com.onedayapp.mystory.oneday.controllers.service.VideoCompositionService: onProgress ----Merge---- video:1781kB audio:32kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.563412%
2018-12-11 13:27:19.148 7435-7435/com.onedayapp.mystory.dev D/com.onedayapp.mystory.oneday.controllers.service.VideoCompositionService: Merged successfully message---------ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (GCC)  configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xf4524600] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from '/storage/emulated/0/OneDay/Member/128/Video/Story/94071beb-0b5f-4588-b388-ff78d24c07a8/concatVideo.txt':
  Duration: N/A, start: 0.000000, bitrate: 695 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 693 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s
    Metadata:
      handler_name    : SoundHandler
Output #0, mp4, to '/storage/emulated/0/OneDay/Member/128/Video/Story/94071beb-0b5f-4588-b388-ff78d24c07a8/Final.mp4':
  Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 693 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 2 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 @ 0xf4524600] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132096, current: 24152; changing to 132097. This may result in incorrect timestamps in the output file.
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132097, current: 25176; changing to 132098. This may result in incorrect timestamps in the output file.
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132098, current: 26200; changing to 132099. This may result in incorrect timestamps in the output file.
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132099, current: 27224; changing to 132100. This may result in incorrect timestamps in the output file.
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132100, current: 28248; changing to 132101. This may result in incorrect timestamps in the output file.
[mp4 @ 0xf4524c00] Non-monotonous DTS in output stream 0:1; previous: 132101, current: 29272; changing to 132102. This may result in incorrect timestamps in the output file.

Последние несколько строк - это сообщение onSuccess (), когда я запускаюс Конкат Демуксером.Все файлы * .mp4.

...