Screen capture delay due to writing data in the file


I think it is not possible as pointed by mah as well.

The code below will help you keep the app responsive while you are writing the image in memory.

This is because the UI/main thread is busy in writing the captured screenshot in memory. So the easiest way to solve this issue is AsyncTask.

public CaptureScreenShot extends Activity
{
  ArrayList<bitmap> arrayListImage;
  int i=0;

  public void captureScreenshot()
  {
     i++;

     // store the image in arrayList "image"

     new BackgroudClass.execute();
  }

 private class BackgroudClass extends AsyncTask<Void, Void,
Void> 
 {
     @Override
     protected Void doInBackgroud(Void.. params)
     {
        // write the image from arrayList at imageArrayList.get(i);
     }
 }


@Override 
public onStop()
{
    arrayListImage = null; // making it eligible for GC
}

Hope this helps.



Capture the screen image without screen capture spamming

like LogMeIn does or Join.Me in Java

Don't know what those applications do. Maybe Screen Image will do what you want. You can get an image of the desktop or any component in your Java application.


Screen capture delay due to writing data in the file

I think it is not possible as pointed by mah as well.

The code below will help you keep the app responsive while you are writing the image in memory.

This is because the UI/main thread is busy in writing the captured screenshot in memory. So the easiest way to solve this issue is AsyncTask.

public CaptureScreenShot extends Activity
{
  ArrayList<bitmap> arrayListImage;
  int i=0;

  public void captureScreenshot()
  {
     i++;

     // store the image in arrayList "image"

     new BackgroudClass.execute();
  }

 private class BackgroudClass extends AsyncTask<Void, Void,
Void> 
 {
     @Override
     protected Void doInBackgroud(Void.. params)
     {
        // write the image from arrayList at imageArrayList.get(i);
     }
 }


@Override 
public onStop()
{
    arrayListImage = null; // making it eligible for GC
}

Hope this helps.


Android Splash screen with data load and delay

I think the easiest thing to do is in the beginning of your async task, get the current time. When you're done with the work, get the current time again. If this is less than 1.5 secs, then do a Thread.Sleep() for the difference.

Start the next activity in the postExecute(). Something like this:

private class DoStuffAsync extends AsyncTask<Void,
Integer, Long> {
     protected Long doInBackground() {

        long start = new Date().getTime();

        // copy assents

        long end = new Date().getTime();

        if ( end-start < 1500 )
           Thread.sleep( 1500-(end-start));

         return totalSize;
     }

     protected void onPostExecute(Long result) {
         startActivity( new Intent(Activity.this, NewActivity.class));
     }
 }

Updated: Fixed math problems.


c++ Directx11 capture screen and save to file

Your description is declared but not initialized to anything before setting all your values. Its MiscFlags member could have garbage in it that's mucking up your creation. Try setting description.MiscFlags = 0; or zeroing out the entire description first. If that doesn't do it, here's a stripped down code sample from one of my current libraries that works:

Try this:

HRESULT hr;

ID3D11Resource* pSurface = nullptr;
m_pRenderTargetView->GetResource(&pSurface);

if (pSurface)
{
    D3D11_TEXTURE2D_DESC desc;
    ZeroMemory(&desc, sizeof(desc));
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    desc.Width = clientWidth;
    desc.Height = clientHeight;
    desc.MipLevels = 1;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.BindFlags = 0;
    desc.CPUAccessFlags = 0;
    desc.Usage = D3D11_USAGE_DEFAULT;

    ID3D11Texture2D* pTexture = nullptr;
    hr = m_pDevice->CreateTexture2D(&desc, nullptr,
&pTexture);
    if (pTexture)
    {
        m_pContext->CopyResource(pTexture, pSurface);
        hr = D3DX11SaveTextureToFileA(m_pContext, pTexture,
D3DX11_IFF_PNG, "ss.png");
        pTexture->Release();
    }
    pSurface->Release();
}

ffmpeg screen capture using screen-capture-recorder cmd not working in vb
    This is my code

    Dim sAppPath As String
    Dim sCommand As String
    Dim sFilePath As String

    sCommand = AppSettings.Get("command")
    sFilePath =
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
    'Full HD
    sAppPath =
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
& "converterinffmpeg.exe " & sCommand & " " &
sFilePath & "RENDER" & m_sFileName & ".mp4"
    WriteLog("Testing " & sCommand & " " & sFilePath &
" " & sAppPath)
    'sAppPath =
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
& "converterinffmpeg.exe -f dshow  -vcodec rawvideo -s 1920x1080 
-r 24 -pix_fmt yuv420p -i video=screen-capture-recorder -c:v libx264
-pix_fmt yuv420p -preset ultrafast -qp 0 -tune zerolatency -vf fps=24
-framerate 24 -y" & " C:UsersBode20DocumentsRENDER" &
m_sFileName & ".mp4"
    ProcID = Shell(sAppPath, AppWinStyle.MinimizedFocus)

Writing to same file concurrently delay

You need to decouple your reading and writing. You can do this by using queues.

Create a single thread-safe message queue (ConcurrentQueue springs to mind).

Clients push messages into the queue.

Have a single writer that pops messages from the queue and commits each message in turn to disk (concurrent file IO from multiple threads is usually a performance killer anyway).

Now, the only synchronisation you need is taken care of by the queue, so it nicely eliminates a potential source of deadlock/blocking, and both ends of the consumer/producer chain are able to work at top speed.

Alternatively, take a look at TPL DataFlow. It's built for these sorts of producer/consumer situations. It's a worthy investment of your time.



- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow