mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.85k stars 2.87k forks source link

[ffmpeg/encode] mpv doesn't encode video. Queue input is backward in time. #6105

Open Broky opened 6 years ago

Broky commented 6 years ago

Hey guys, i wanted to convert/cut/crop a video into a webm as usual, but for some reason it stopped wrking the usual way. I already tried to run with the default config without success, so maybe you guys could help me further here.

terminal output:

mpv test.ts --start=0:07:41.268 --end=0:07:50.000 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=1 --sid=no --sub-ass-override=yes --sub-auto=exact --video-rotate=0 --vf-add=lavfi-colormatrix=bt709:bt601 --vf-add=lavfi-crop=662:1076:594:2 --vf-add=lavfi-scale=-1:720 --ovcopts-add=threads=4 --oset-metadata=title=%4%test --ovcopts-add=b=0 --ovcopts-add=crf=10 -o=./test-[07.41.268-07.50.000]-audio.webm --log-file=./log Playing: test.ts (+) Video --vid=1 (h264 1920x1080 29.970fps) (+) Audio --aid=1 (aac 2ch 44100Hz) [ffmpeg] swscaler: Warning: data is not aligned! This can lead to a speed loss VO: [lavc] 443x720 => 443x720 yuv420p [vo/lavc] Opening encoder: libvpx VP8 [libvpx] [ao/lavc] Opening encoder: libvorbis [libvorbis] [encode] Opening output file: ./test-[07.41.268-07.50.000]-audio.webm [encode] Opening muxer: WebM [webm] AO: [lavc] 44100Hz stereo 2ch floatp AV: 00:07:42 / 00:50:44 (15%) A-V: 0.018 {0.0min 41.7fps 0.0MB} [ffmpeg] libvorbis: Queue input is backward in time AV: 00:07:43 / 00:50:44 (15%) A-V: 0.022 {0.1min 37.2fps 0.0MB} [ffmpeg] libvorbis: Queue input is backward in time AV: 00:07:43 / 00:50:44 (15%) A-V: 0.010 {0.1min 38.7fps 0.0MB} [ffmpeg] libvorbis: Queue input is backward in time AV: 00:07:45 / 00:50:44 (15%) A-V: 0.001 {0.2min 39.2fps 0.0MB} [ffmpeg] libvorbis: Queue input is backward in time AV: 00:07:45 / 00:50:44 (15%) A-V: 0.021 {0.3min 39.6fps 0.0MB} [ffmpeg] libvorbis: Queue input is backward in time [ffmpeg] webm: Application provided invalid, non monotonically increasing dts to muxer in stream 1: 4019 >= 4012 [encode] Writing packet failed.

Exiting... (End of file)

mpv version and platform

mpv 0.29.0 on windows

Reproduction steps

Happens with several recorded ts files. They're rather large, so let me know if you really need them before i clunk up ressources somewhere.

Expected behavior

Convert part of the video into webm. Originally i used the mpv-webm extension to form up the command.

Actual behavior

Gives me an unusable 4.58kb big file

Log file

https://0x0.st/svP2.txt

I assume the problem lies with vorbis and if so any idea how to fix that? Greetings Broky

kelciour commented 4 years ago

The issue isn't very important to me, FFmpeg works fine in this case, but if it helps, the same problem happens with I.Robot.2004.1080p.BluRay.H264.AAC-RARBG.mp4 using the following command to cut video from 00:13:35.545 to 00:13:40.000 and convert to webm using libvorbis:

mpv H:/Downloads/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG.mp4 --start=00:13:35.545 --end=00:13:40.000 --sub=no --vf-add=lavfi-scale=-2:320 --ovc=libvpx-vp9 --ovcopts=b=1400K,threads=4,crf=23,qmin=0,qmax=36,speed=2 --oac=libvorbis --o=I.Robot.2004.1080p.BluRay.H264.AAC-RARBG_00.13.35.545-00.13.40.000.webm

Similar command seems to work fine with FFmpeg. There're a lot of [libvorbis @ 04f666c0] Queue input is backward in time messages, but the resulted file is playable.

ffmpeg -ss 00:13:35.545 -i H:/Downloads/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG.mp4 -t 4.455 -vf scale=-2:320 -c:v libvpx-vp9 -b:v 1400K -threads 4 -crf 23 -qmin 0 -qmax 36 -speed 2 -c:a libvorbis I.Robot.2004.1080p.BluRay.H264.AAC-RARBG_00.13.35.545-00.13.40.000.webm

For some reason, it fails if it starts from 00.13.35.529 and up to 00.13.35.570, i.e. 42ms, but works fine after adding to the start time ±50ms, i.e. something like

mpv H:/Downloads/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG/I.Robot.2004.1080p.BluRay.H264.AAC-RARBG.mp4 --start=00:13:35.495 --end=00:13:40.000 --sub=no --vf-add=lavfi-scale=-2:320 --ovc=libvpx-vp9 --ovcopts=b=1400K,threads=4,crf=23,qmin=0,qmax=36,speed=2 --oac=libvorbis --o=I.Robot.2004.1080p.BluRay.H264.AAC-RARBG_00.13.35.495-00.13.40.000.webm

And with libopus mpv just crashes.


mpv 0.30.0-195-gb31f2f6cb9 Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
 built on Sun Nov 24 08:09:32 +08 2019
ffmpeg library versions:
   libavutil       56.36.100
   libavcodec      58.62.100
   libavformat     58.35.100
   libswscale      5.6.100
   libavfilter     7.67.100
   libswresample   3.6.100
ffmpeg version: git-2019-11-23-d65aaf8e

ffmpeg version git-2019-11-01-53c21c2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191010
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-g
nutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfree
type --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-li
bopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-
libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib -
-enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmys
ofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec
--enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avis
ynth --enable-libopenmpt --enable-amf
libavutil      56. 35.101 / 56. 35.101
libavcodec     58. 60.100 / 58. 60.100
libavformat    58. 33.100 / 58. 33.100
libavdevice    58.  9.100 / 58.  9.100
libavfilter     7. 66.100 /  7. 66.100
libswscale      5.  6.100 /  5.  6.100
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100
ghost commented 4 years ago

That means it complains that audio encoder input timestamps go backwards. No clue why that would happen.