MathewSachin / Captura

Capture Screen, Audio, Cursor, Mouse Clicks and Keystrokes
https://mathewsachin.github.io/Captura/
MIT License
9.7k stars 1.81k forks source link

Record video's output is only 700k which is nothing. #401

Closed hachi1030-Allen closed 5 years ago

hachi1030-Allen commented 5 years ago

I recorded screen video today, and after I stop recording, it showed that the file has been saved to the path that I set.

However, when I checked on the video, it's only 680kb and nothing can be played. image

This video is really important to me, anything I can do to recover it? It's an one and half hour video that I recorded with important information!

Please let me know the solution! Thanks!

MathewSachin commented 5 years ago

I'm very sorry, the video cannot be recovered if it was not written to disk.

Does this happen for every recording you make? In that case, please let me know the settings you were using, your system specifications and the FFmpeg log so that I can figure out what happened.

hachi1030-Allen commented 5 years ago

Hi @MathewSachin

I just started to use this tool. First time the video recording is successfully and it's great. But yesterday I used again and got this issue.

Not sure how to give you the setting, but below is the FFmpeg log for yesterday:

ARGS:

-thread_queue_size 512 -framerate 10 -f rawvideo -pix_fmt rgb32 -video_size 3840x2160 -i \.\pipe\captura-dbbb72c4-d769-47b9-82da-666f18481edc -thread_queue_size 512 -f s16le -acodec pcm_s16le -ar 44100 -ac 2 -i \.\pipe\captura-83906731-23d2-4567-a56f-2cb02c86da83 -r 10 -vcodec libx264 -crf 15 -pix_fmt yuv420p -preset ultrafast -c:a aac -strict -2 -b:a 256k "D:\CapturaStore\2019-04-30-17-03-33.mp4"

OUTPUT:

ffmpeg version N-93649-gd0ca749adb Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 52.100 / 58. 52.100 libavformat 58. 27.103 / 58. 27.103 libavdevice 58. 7.100 / 58. 7.100 libavfilter 7. 49.100 / 7. 49.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Input #0, rawvideo, from '\.\pipe\captura-dbbb72c4-d769-47b9-82da-666f18481edc': Duration: N/A, start: 0.000000, bitrate: 2654208 kb/s Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 3840x2160, 2654208 kb/s, 10 tbr, 10 tbn, 10 tbc Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, s16le, from '\.\pipe\captura-83906731-23d2-4567-a56f-2cb02c86da83': Duration: N/A, bitrate: 1411 kb/s Stream #1:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 000001b81929dcc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000001b81929dcc0] profile Constrained Baseline, level 5.1, 4:2:0, 8-bit [libx264 @ 000001b81929dcc0] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=10 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=15.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to 'D:\CapturaStore\2019-04-30-17-03-33.mp4': Metadata: encoder : Lavf58.27.103 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 3840x2160, q=-1--1, 10 fps, 10240 tbn, 10 tbc Metadata: encoder : Lavc58.52.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 256 kb/s Metadata: encoder : Lavc58.52.100 aac frame= 2 fps=0.0 q=-1.0 Lsize= 677kB time=00:00:00.10 bitrate=55430.7kbits/s speed=0.441x
video:677kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.119237% [libx264 @ 000001b81929dcc0] frame I:1 Avg QP:12.00 size:679370 [libx264 @ 000001b81929dcc0] frame P:1 Avg QP:11.00 size: 12767 [libx264 @ 000001b81929dcc0] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 000001b81929dcc0] mb P I16..4: 0.9% 0.0% 0.0% P16..4: 8.2% 0.0% 0.0% 0.0% 0.0% skip:90.9% [libx264 @ 000001b81929dcc0] coded y,uvDC,uvAC intra: 43.4% 12.1% 12.0% inter: 2.3% 1.1% 0.1% [libx264 @ 000001b81929dcc0] i16 v,h,dc,p: 65% 29% 4% 1% [libx264 @ 000001b81929dcc0] i8c dc,h,v,p: 84% 9% 6% 1% [libx264 @ 000001b81929dcc0] kb/s:27685.48 [aac @ 000001b8192a1c40] Qavg: nan

I will capture some screenshot on the setting as below:

image

Let me know what else do you need.

Please do let me know if there is anything that we can accelerate this process because I don't want this to happen again.

Thanks.

MathewSachin commented 5 years ago

I think it is due to large resolution of recorded area (3840x2160). Captura is not optimized for recording large screens. I'm working on it but it might take some time.

Try recording smaller regions. Upto 1920x1080 should work fine. Please let me know if the recording fails for smaller regions.

hachi1030-Allen commented 5 years ago

Hi @MathewSachin ,

Thanks for the reply.

But I remember that the first time I was also capturing the video on that area, the 3840x2160. Why did that work?

And which information in the log indicated this error? How can I avoid this kind of thing in the future?

Thanks.

MathewSachin commented 5 years ago

The pipe error happens only when using FFmpeg. I'm working on a Media Foundation H.264 writer (currently shown as MF). Select it instead of FFmpeg and try recording. Today, I successfully recorded 4 hr 30 min video using it of 1920x1080 at 30 fps.

Please test this in the latest dev build. Here's the link: https://ci.appveyor.com/api/buildjobs/ihfygv3agu5sbl4u/artifacts/Captura-Portable.zip

Also, did some optimizations for larger screens. Please try that too.

Thank you

hachi1030-Allen commented 5 years ago

Hi Mathew,

Got error when clicking on the recording button.

SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: Invalid Arguments。

at SharpDX.Result.CheckError() at SharpDX.DXGI.Output1.DuplicateOutput(IUnknown deviceRef) at DesktopDuplication.DuplCapture.Init() at DesktopDuplication.DuplCapture..ctor(Output1 Output) at DesktopDuplication.DesktopDuplicator..ctor(Boolean IncludeCursor, Output1 Output, IPreviewWindow PreviewWindow) at Captura.Models.DeskDuplImageProvider..ctor(Output1 Output, Boolean IncludeCursor, IPreviewWindow PreviewWindow) at Captura.WindowsPlatformServices.GetScreenProvider(IScreen Screen, Boolean IncludeCursor) at Captura.Models.ScreenItem.GetImageProvider(Boolean IncludeCursor) at Captura.ViewModels.RecordingModel.GetImageProvider(RecordingModelParams RecordingParams) at Captura.ViewModels.RecordingModel.SetupVideoRecorder(IAudioProvider AudioProvider, RecordingModelParams RecordingParams)

Please check why this is happening.

Thanks.

MathewSachin commented 5 years ago

Not sure why this error is happening. I can't reproduce this error on the multiple systems that I tried. I'll look into it further.

In the meantime, the only alternative left is to use the SharpAvi writer. It creates AVI files.

allenliu1030 commented 5 years ago

Hi Mathew,

Ok, switched to SharpAvi, seems working fine for now.

May I know the difference here? Is avi file larger than mp4 file?

Thanks.

MathewSachin commented 5 years ago

Yes, the AVI file created by Captura is larger than Mp4 file.

hachi1030-Allen commented 5 years ago

Hi Mathew,

Please keep investigating the issue. BTW, are u sure SharpAvi will be very stable without any issue?

Thanks.

Mathew Sachin notifications@github.com 于 2019年5月4日周六 20:25写道:

Yes, the AVI file created by Captura is larger than Mp4 file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MathewSachin/Captura/issues/401#issuecomment-489322439, or mute the thread https://github.com/notifications/unsubscribe-auth/AHWLZ6PYPA3QB224QRDYTDTPTV6EDANCNFSM4HJMNLUQ .

MathewSachin commented 5 years ago

I can't guarantee that there won't be any issue but at least the pipe broken error will not happen. Also, does SharpAvi work for you in the dev build I provided you too? The error you reported makes me believe that it might not. Please check.

hachi1030-Allen commented 5 years ago

Hi Mathew,

You are correct, the dev build cannot capture video using SharpAvi.

Error message here: SharpDX.SharpDXException: HRESULT: [0x887A0004], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_UNSUPPORTED/Unsupported], Message: 指定的设备接口或功能级别在此系统上不受支持。

at SharpDX.Result.CheckError() at SharpDX.Direct3D11.Device.CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels) at DesktopDuplication.Direct2DEditorSession..ctor(Int32 Width, Int32 Height, IPreviewWindow PreviewWindow) at DesktopDuplication.DesktopDuplicator..ctor(Boolean IncludeCursor, Output1 Output, IPreviewWindow PreviewWindow) at Captura.Models.DeskDuplImageProvider..ctor(Output1 Output, Boolean IncludeCursor, IPreviewWindow PreviewWindow) at Captura.WindowsPlatformServices.GetScreenProvider(IScreen Screen, Boolean IncludeCursor) at Captura.Models.ScreenItem.GetImageProvider(Boolean IncludeCursor) at Captura.ViewModels.RecordingModel.GetImageProvider(RecordingModelParams RecordingParams) at Captura.ViewModels.RecordingModel.SetupVideoRecorder(IAudioProvider AudioProvider, RecordingModelParams RecordingParams)

Do you want something like a remote session to look at my PC or something like that to determine the root cause?

Thanks.

MathewSachin commented 5 years ago

I'm currently busy with my exams, so don't have the time to completely investigate the issue. I'll be free in a week, then I can do that.

For now, as per the error I'm seeing this time, please let me know the following:

hachi1030-Allen commented 5 years ago

Hi Mathew,

For your questions:

  1. Not sure what is GPU model. But please check below screenshot from TaskManager: image

  2. CPU model: image

  3. DirectX version: DirectX 12

  4. Windows version: Windows 10 1803 (17134.706)

MathewSachin commented 5 years ago

Is your system a laptop or a desktop?

Also, try running the dev build on the integrated graphics, if available.

MathewSachin commented 5 years ago

Also, does recording with OBS Studio work on your system. If not it might be a driver or hardware issue.

https://obsproject.com

hachi1030-Allen commented 5 years ago

Hi,

Yes, OBS is working perfectly.

Thanks

Mathew Sachin notifications@github.com 于 2019年5月5日周日 03:58写道:

Also, does recording with OBS Studio work on your system. If not it might be a driver or hardware issue.

https://obsproject.com

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MathewSachin/Captura/issues/401#issuecomment-489360764, or mute the thread https://github.com/notifications/unsubscribe-auth/AHWLZ6MOGP42JWGBM2M3QADPTXTHVANCNFSM4HJMNLUQ .

hachi1030-Allen commented 5 years ago

Hi,

Did not find the Integrated Graphics setting in the NVIDIA control panel.

Out of curiosity, why the formal version of Captura can at least record on my PC, that's just having some issue, but the dev build failed totally?

Also, is it possible that I install back the formal version and use SharpAvi?

Thanks.

MathewSachin commented 5 years ago

The formal version of Captura used GDI for capture which has high CPU usage and low FPS. The newer version uses Direct3D. Using it along with the Media Foundation writer greatly reduces CPU usage by doing the tasks on GPU or hardware encoder. I'm quite new to Direct3D so might have messed something up. It works fine on all the laptops I've tested though.

Yes, since the build I gave you was a portable one, you could continue using SharpAvi with the older version but I won't really recommend that because the performance is not good enough.

BTW, I've tried doing some tweaks to the code. Please test this new dev build: https://ci.appveyor.com/api/buildjobs/ev943gnspsxvt8kw/artifacts/Captura-Portable.zip

hachi1030-Allen commented 5 years ago

Hi Mathew,

This one worked! Not sure what you have done, but I can use MF to record video.

Will test more in daily usage.

Thanks.

MathewSachin commented 5 years ago

Thats awesome 👍. Please test and let me know how it works.

hachi1030-Allen commented 5 years ago

Sure thing!

Thanks for the great work! Really appreciate it.

On Sun, May 5, 2019 at 5:30 PM Mathew Sachin notifications@github.com wrote:

Thats awesome 👍. Please test and let me know how it works.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MathewSachin/Captura/issues/401#issuecomment-489408460, or mute the thread https://github.com/notifications/unsubscribe-auth/AHWLZ6OH7JRF645PF5364V3PT2SJ5ANCNFSM4HJMNLUQ .

-- Thanks and Best Regards,

Allen Liu