Giter Site home page Giter Site logo

nvpipe's Introduction

Deprecation Notice

NvPipe is deprecated and will receive no further updates or support.

For a concise yet versatile convenience wrapper around the low-level NVENC/NVDEC APIs please refer to the NvCodec wrapper classes in the official NVIDIA Video Codec SDK.

Several samples are included in the Video Codec SDK. Furthermore, feel free to checkout the NvPipe source code for exemplary usage.

Support inquiries and feature requests should be directed to the official Video Codec SDK Developer Forums.

The original NvPipe README can be found here.

nvpipe's People

Contributors

tbiedert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nvpipe's Issues

NVENC doesn't initialize with EGL context on Linux

Hi, I didn't find another place to file this bug. I am using Linux Ubuntu 16.04. I decided to try EGL API for OpenGL offscreen context creation. The context is created ok, no errors. But the NVENC fails to init with the error:

nvStatus = m_pEncodeAPI->nvEncOpenEncodeSessionEx(&openSessionExParams, &m_hEncoder);

nvStatus = NV_ENC_ERR_UNSUPPORTED_DEVICE.

Do you have an idea why that happens?

EGL init part:

const EGLint configAttribs[] = {
         EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
         EGL_BLUE_SIZE, 8,
         EGL_GREEN_SIZE, 8,
         EGL_RED_SIZE, 8,
         EGL_DEPTH_SIZE, 8,
         EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
         EGL_NONE
   };

// 1. Initialize EGL
 mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);  
 EGLint major, minor;

 eglCheck(eglInitialize(mEGLDisplay, &major, &minor));
 
 // 2. Select an appropriate configuration
 EGLint numConfigs;
 EGLConfig eglCfg;

 eglCheck(eglChooseConfig(mEGLDisplay, configAttribs, &eglCfg, 1, &numConfigs));
 
 // 3. Create a surface
  
 const EGLint pbufferAttribs[] = {
       EGL_WIDTH, 9,
       EGL_HEIGHT, 9,
       EGL_NONE,
 };
 EGLSurface eglSurf = eglCreatePbufferSurface(mEGLDisplay, eglCfg,  pbufferAttribs);
                                                                                         
 // 4. Bind the API
  eglCheck(eglBindAPI(EGL_OPENGL_API));   

// 5. Create a context and make it current
 const char *extensions = eglQueryString(mEGLDisplay,EGL_EXTENSIONS);
 bool robust_access_ext = ExtensionIsSupported(extensions,"EGL_EXT_create_context_robustness");
 
 EGLint context_attribs[] = {
   EGL_CONTEXT_MAJOR_VERSION,mVersionMajor,
   EGL_CONTEXT_MINOR_VERSION,mVersionMinor,
   EGL_CONTEXT_OPENGL_PROFILE_MASK,EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT,
   EGL_CONTEXT_FLAGS_KHR,
    EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR | 
    EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR ,
     
    EGL_NONE    
   
 };

 mEGLContext = eglCreateContext(mEGLDisplay, eglCfg, EGL_NO_CONTEXT, 
                                      context_attribs); 
  eglCheck(eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mEGLContext));  

NVPIPE_H264_FFMPEG decoder fails to decode valid frames returning NVPIPE_EOVERFLOW

Hi,

I'm trying to implement a remote visualization client/server based on egl-example.cpp with an NVPIPE_H264_NV encoder on the server and an NVPIPE_H264_FFMPEG decoder on clients with pre-Kepler GPU hardware. After applying the patch in #8 I can compile NvPipe with USE_FFMPEG=ON but the decoder returns NVPIPE_EOVERFLOW. My code (derived from egl-example.cpp) is as follows:

#include <cstring>
#include <string>
#include <iostream>
#include <fstream>

#include <nvpipe.h>

#include "mapped_vector.hpp"

void writePPM(const uint8_t *rgb, const uint32_t width, const uint32_t height, const std::string& path)
{
    // For verification...

    size_t numBytes = width * height * 3;

    std::ofstream outFile;
    outFile.open(path.c_str(), std::ios::binary);

    outFile << "P6" << "\n"
            << width << " " << height << "\n"
            << "255\n";

    outFile.write((char*) rgb, numBytes);
}


int main(int /*argc*/, char** /*argv*/)
{
    const uint32_t width = 1920;
    const uint32_t height = 1080;

    mapped_vector<uint8_t> f("frame.h264");

    std::cout << "input has " << f.size() << " bytes" << std::endl;

    /*
     * Client: Init decoder
     */
    nvpipe* decoder = nvpipe_create_decoder(NVPIPE_H264_FFMPEG);
    
    size_t clientBufferSize = width * height * 3;
    uint8_t *clientBuffer = new uint8_t[clientBufferSize];

    nvp_err_t decodeStatus = nvpipe_decode(decoder, &*f.begin(), f.size(), clientBuffer, width, height, NVPIPE_RGB);
    if (decodeStatus != NVPIPE_SUCCESS)
    {
        std::cerr << "Decode failed: " << std::string(nvpipe_strerror(decodeStatus)) << std::endl;
        return 1;
    }

    writePPM(clientBuffer, width, height, "frame.ppm");

    delete[] clientBuffer;
    nvpipe_destroy(decoder);

    return 0;
}

The width and height parameters are identical on the server. mapped_vector is just a wrapper around mmap(2) that allows access to a binary file using a std::vector-like (read-only) API.

The same code works fine if I change the decoder to NVPIPE_H264_NV (on a machine with a Pascal GPU). I can also view the file just fine with ffplay -f h264 -framerate 30 -i frame.h264 (on the same machine as the code above).

Any suggestions?

Cheers,

Rene

Trying to create multiple encoder objects

I work on a scenario where i need to encode 4 streams of video concurrently (4 different cameras for the same scene). So i try to create 4 encoder objects using the NvPipe_CreateEncoder function. After the first couple is created, the 3rd and 4th fail to be created giving an error with code 10. I work on a gtx 1070. Is it related to my hardware (i.e. the number of engines my gpu has) or NvPipe can not work in this manner because of objects sharing some state? Thank you in advance.

NvPipe.NET

I saw the presentation of NVPipe in Brno. I would love to integrate it into my existing tool, therefore I am wondering if it is possible to wrap it for the use with OpenTK / other .NET based applications.

Second encoder session fails to encode first frame every time

After creating the second encoder, the first frame I send to it yields the following error:

Failed to create encoder (NvEncoder::NvEncoder : m_nvenc.nvEncOpenEncodeSessionEx(&encodeSessionExParams, &hEncoder) returned error 10 at g:\main repo\nvpipe\nvpipe-master\src\nvcodec\nvencoder\nvencoder.cpp:54
)

After that the rest of the frames encode, but resolution is set to 1920x1080. (I've been using 1152x648 resolution.) I tried to force an I-frame but it didnt make any difference.

I checked the error code which is nv_enc_err_out_of_memory.. I've monitored my memory on task manager and it looks completely fine.

for decoding I'm using ffplay.
This is the output from first encoder raw h264 play:

Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1152x648 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1200k tbn, 120 tbc
nan M-V: nan fd= 3 aq= 0KB vq= 2730KB sq= 0B f=0/0

and this is the output from second encoder raw h264 play:
Input #0, h264, from 'C:\Users\ghost\Desktop\HSE_Server_CT\clientcsharp2.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1200k tbn, 120 tbc
nan M-V: nan fd= 4 aq= 0KB vq= 2494KB sq= 0B f=0/0

in both cases same input is being sent and same parameters are being used to initialize encoder and use it..

I've been stuck at this for a while.. thanks for your help!

Error in NvPipe_CreateEncoder with NV_ENC_H264_PROFILE_BASELINE_GUID

Hello,
I need to encode with the baseline profile
so I changed the presetGUID in NvPipe.cu to NV_ENC_H264_PROFILE_BASELINE_GUID
(

GUID presetGUID = NV_ENC_PRESET_LOW_LATENCY_HQ_GUID;
)

But the NvPipe_CreateEncoder returns an error 8 (NV_ENC_ERR_INVALID_PARAM).
It works with the default profile, I also changed the format (NVPIPE_BGRA32, NVPIPE_UINT8, NVPIPE_UINT16 etc), no result.

System :
Cuda compilation tools, release 10.0, V10.0.130
Linux Ubuntu 18

Tue Jan 15 15:28:58 2019 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 410.57 Driver Version: 410.57 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 107... Off | 00000000:01:00.0 Off | N/A | | N/A 37C P8 5W / N/A | 103MiB / 8119MiB | 0% Default | +-------------------------------+----------------------+----------------------+

Porting to new NvPipe: Video quality/bitrate parameter

Hi all,

can you clarify the semantics of the bitrate parameter of the new (post CUDA 9) NvPipe compared with the old one? Using the same parameter value is the H264 video quality expected to stay the same after decoding? I previously used the following:

const size_t f_m = 5;
const uint64_t bitrate = width*height * fps*f_m*0.07; // Kush gauge

With the new NvPipe, this gives visually worse results than before, i.e. the decoded image is blurrier and exhibits more artifacts.

Cheers,

Rene

Provide example for SLI support?

Hey,

Can I get an example on how to use NVPIPE with SLI support?

My code right now:

if(numEncodersInUse < 2)                                           //first device 
	cudaError_t status = cudaSetDevice(0); 
else                                                               //second device
	cudaError_t status = cudaSetDevice(1); 

if (status  != cudaSuccess)
	return -1;
nvps[id] = nvpipe_create_encoder(NVPIPE_H264_NV, quality);

if(nvp[id] != NULL)
	numEncodersInUse ++;

I get two devices using cudaGetDeviceCount.
I can set first or second device and use two encoders without any problem.
But, when I start three, I get Access Violation error in nvpipe.dll.

Any thoughts?

Thanks in advance.

nvpipe_decode() segfaults

I have compiled NvPipe with the following setup:

  • Release
  • Ubuntu 17.04 x64
  • GCC 6.3.0
  • Driver 390.25
  • Video Codec SDK 8.0
  • CUDA 9.1
  • GTX 1050

I have been testing a small client-server example, in which the server renders something which it is then encoded and sent to the client for decoding.

Everything seems to be working properly on the encoding side, but when I try to decode the result:

nvp_err_t decodeStatus = nvpipe_decode(decoder, clientReceiveBuffer, numBytes, clientDeviceBuffer, width, height, NVPIPE_RGBA);

I get the following segfault:

[1]    23652 segmentation fault (core dumped)  ./zero-latency-client

Any advice on how to fix this?

Encoding profileGUID

Hi Tim,

I noted NvPipe does not "touch" the encoder profileGUID. Allowing the user to setting it up can be useful for web-based clients since media source extensions need profile specification.

What is the encoder profileGUID NvPipe is using for H.264 ?

Thanks,

Benjamin

Porting to new NvPipe: R and B channels swapped?

Hi all,

could it be that the new NvPipe actually expects input to be BGRA rather than RGBA? I forgot to mention this earlier because it was easy for me to work around by swapping the R and B channels after decoding (in software; using FFMPEG).

In hindsight, this might also play a role in #34 as swapping after decoding is not the same if the encoder applies psycho-visual tricks...

Cheers,

Rene

Makefiles generated by cmake can't find the nvcuvid libraries by default

Turns out the video-codec-sdk libraries are distributed with the driver and not CUDA.
Sigh... Nvidia...
The link commands generated by CMake weren't automatically including the correct library search path.
I got around this by adding -L/usr/lib/nvidia-396 (on a Ubuntu system) to each generated link.txt (in CMakeFiles/NvPipe.dir etc).

I don't really understand CMake or I'd send a PR, but is there some way for you to include the nvidia driver path automatically in the generated compiler commands?

Running in a docker

I try to use NvPipe in a docker. I created my image using the nvidia/cuda:9.2-runtime-ubuntu18.04 as a starting point. At runtime i get the error: "Failed to create encoder. Error: Failed to create encoder (LoadNvEncApi : NVENC library file is not found. Please ensure NV driver is installed at [some local path]"
I suppose that the nvidia image has the 396 driver "installed". Am i conceptually wrong?

Unable to compile NvPipe on Windows 10

My goal is to successfully compile NvPipe on Windows 10 to include it in a project.

Here's the error I get:

1>------ Skipped Build: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: NvPipe, Configuration: Debug x64 ------
2>LINK : fatal error LNK1104: cannot open file 'C:\Users\digit\Desktop\workspace\NvPipe\build\CMakeFiles\NvPipe.dir\src\Debug\NvPipe_generated_NvPipe.cu.obj'
2>Done building project "NvPipe.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

That file does not exist for me:

(py2) suhail@mighty-dev:/mnt/c/Users/digit/Desktop/workspace/NvPipe/build/CMakeFiles/NvPipe.dir/src/Debug$ ls -la
total 0
drwxrwxrwx 1 suhail suhail 4096 Mar 22 15:51 .
drwxrwxrwx 1 suhail suhail 4096 Mar 22 15:51 ..

Environment:

OS Name:                   Microsoft Windows 10 Home
OS Version:                10.0.17134 N/A Build 17134
System Type:               x64-based PC

Include dirs: http://prntscr.com/n1peud

I began setting up compilation via: cmake ../ -D NVPIPE_WITH_OPENGL=OFF

support YUV inputs

Forgive me if I'm mistaken since I've only skimmed the NvPipe source, but it looks like it currently converts from RGB to YUV internally, and it would be really helpful if I could just use YUV directly.

Many webcams on the market only provide YUV sources directly, for example.

performance degredation using cudaMallocManaged (Unified Memory) instead of cudaMalloc

When using cudaMallocManaged, the performance in the memory example is exactly equal to simply using host memory.

Forgive me if I'm misunderstanding, but it seems like while there's some performance difference between using cudaMalloc and cudaMallocManaged, it shouldn't be this extreme?

This was tested on a GTX 1080.

with cudaMalloc()

NvPipe example application: Comparison of using host/device memory.

Resolution: 3840 x 2160
Codec: HEVC
Bitrate: 32 Mbps @ 60 Hz
Resolution: 3840 x 2160

--- Encode from host memory / Decode to host memory ---
Frame | Encode (ms) | Decode (ms) | Size (KB)
    0 |        74.2 |        47.5 |     47.4
    1 |        26.2 |        17.0 |     14.2
    2 |        26.1 |        17.1 |     10.4
    3 |        26.0 |        16.9 |      8.2
    4 |        26.1 |        17.1 |      7.5
    5 |        26.2 |        17.1 |      6.1
...

--- Encode from device memory / Decode to device memory ---
Frame | Encode (ms) | Decode (ms) | Size (KB)
    0 |        59.9 |        34.3 |     47.4
    1 |        12.5 |         5.1 |     14.2
    2 |        12.2 |         5.1 |     10.4
    3 |        12.3 |         4.9 |      8.2
    4 |        12.3 |         5.0 |      7.5
    5 |        12.3 |         5.0 |      6.1
...

with cudaMallocManaged(..., cudaMemAttachGlobal)

--- Encode from device memory / Decode to device memory ---
Frame | Encode (ms) | Decode (ms) | Size (KB)
    0 |        93.6 |        47.6 |     47.4
    1 |        26.2 |        16.8 |     14.2
    2 |        26.2 |        17.3 |     10.4
    3 |        26.3 |        16.9 |      8.2
    4 |        26.4 |        17.3 |      7.5
    5 |        26.5 |        17.0 |      6.1
    6 |        26.4 |        17.2 |      6.1

Can't compile / make

Hi there,

I must be doing something silly wrong:

PS C:\Users\digit\Desktop\workspace\NvPipe\build> cmake ../ -D NVPIPE_WITH_OPENGL=OFF
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1 (found version "10.1")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/digit/Desktop/workspace/NvPipe/build

PS C:\Users\digit\Desktop\workspace\NvPipe\build> make
make: *** No targets specified and no makefile found.  Stop.

NvPipe_DecodeTexture hangs if NvPipe_EncodeTexture is not used first

When separating example code in two independent processes NvPipe_DecodeTexture hangs indefinitely. This can be reproduced in the EGL example commenting the encoder lines and using a 0 initialized vector in the decoder.

uint64_t r = NvPipe_DecodeTexture(decoder, compressed.data(), size, clientColorTex, GL_TEXTURE_2D, width, height);

Asynchronous Encoder and Best practices for high-performance

Hi,

I am trying to achieve high performance and not sure how to go about. Here is my plan:

Thread 1: Reading/Writing on network socket (using boost::asio)
Thread 2: Rendering using OpenGL textures
Thread 3: Encoding Rendered buffers (using NvPipe)

render_frame i -> push rendered frame into queue_1
pop frame from queue_1 and encode frame -> push encoded frame into queue_2
pop encoded frame from queue_2 and perform async_write() over network socket

Is there a way I can do the tasks in bold (e.g. render frame and encoding frame) in an asynchronous manner, such that the handler would do corresponding task of pushing rendered/encoded frame into the queue?

Can I use NvPipe to achieve asynchronous encoding? If yes, can I get some pointers on how to do it.

Thanks!

Current version does not build

On Ubuntu 14.04, I get the message
/lhome/chhoene/github/NvPipe/src/NvPipe.cu(75): error: class "cudaPointerAttributes" has no member "type"

Cannot include NvPipe in as third-party in another CMake project

Hey NvPipe developers,

Thanks for the really useful library!

I'm trying to include NvPipe as a third-party library within a much larger project. When, I do the normal CMake add_subdirectory(NvPipe), I get the following error:

CMake Error in third_party/NvPipe/CMakeLists.txt:
  Target "NvPipe" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "<omitted my root project path here>/third_party/NvPipe/"

  which is prefixed in the source directory.

My googling has confirmed that this is the offending line in NvPipe's CMakeLists.txt:

target_include_directories(${PROJECT_NAME} PUBLIC
    $<BUILD_INTERFACE:src/NvCodec ${CUDA_INCLUDE_DIRS}>
    $<INSTALL_INTERFACE:include>
    )

And, indeed, if I comment out that line then the NvPipe's CMake completes, although the project can't build as it can't find headers like NvPipe.h.

I don't know how to fix this (I tried a few things), but I feel this StackOverflow answer is very information-rich: https://stackoverflow.com/questions/25676277/cmake-target-include-directories-prints-an-error-when-i-try-to-add-the-source

encoded data creates corrupted video file

Hi guys,

We are trying to create a stream from our OpenGL renderer over the web. I basically followed the EGL example you have and then choose to send that over TCP. But in the web browser, the video doesn't play.

I decided to save the output into a file and I'm getting this one here:
https://www.dropbox.com/s/513axsne97u327b/test.mp4?dl=0

VLC can't play it and I actually managed to play it with another application that had to download a very obscure plugin, but it plays it. If opened on Windows, some video players say the file is corrupted.

There's probably something very minor missing in here to have a valid file and be able to stream it in the browser.

This is how my encoder is created:

const int QUALITY = 2;
const int FPS = 30;
encoder = nvpipe_create_encoder(NVPIPE_H264_NV, width*height*QUALITY*FPS*0.07);

I tried different values for the bit rate, but didn't change anything.

Thanks

High memory consumption for decoder

Hello,
I’m instantiating 8 instances of the H264 decoder to decode 8 streams in parallel. It works great! However it consumes like 3.2GB of CUDA memory. This is a lot. Is there a way to reduce the amount of memory consumed per instance?

I’m using BGRA32 for output to device memory.

Thanks!

nvcuvid.h: No such file or directory

Hi,

I got the error when compiling this project on Ubuntu 16.04: nvcuvid.h: No such file or directory. Could you let me know how to solve this issue? @tfogal

The detail logs shown on the terminal is here:

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: /usr/local/cuda (found version "9.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Could NOT find EGL (missing: EGL_LIBRARY EGL_opengl_LIBRARY EGL_INCLUDE_DIR)
-- Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luyang/Documents/NvPipe-master/build
luyang@luyang-ubuntu:~/Documents/NvPipe-master/build$ make
[ 12%] Building NVCC (Device) object CMakeFiles/nvpipe.dir/convert.o
Scanning dependencies of target nvpipe
[ 25%] Building C object CMakeFiles/nvpipe.dir/debug.c.o
[ 37%] Building C object CMakeFiles/nvpipe.dir/decode.c.o
/home/luyang/Documents/NvPipe-master/decode.c:44:21: fatal error: nvcuvid.h: No such file or directory
compilation terminated.
CMakeFiles/nvpipe.dir/build.make:93: recipe for target 'CMakeFiles/nvpipe.dir/decode.c.o' failed
make[2]: *** [CMakeFiles/nvpipe.dir/decode.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/nvpipe.dir/all' failed
make[1]: *** [CMakeFiles/nvpipe.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

out of memory while trying to create encoder

Hi all,

I have an old GTX 750 with 1Go VRAM.
If I run a game and after try to start an Encoder , I have a " out of memory" because the game all the available VRAM.
Is there a way to force the GPU to free required memory to start an encoder ?

Thank's for your help
sylvain

Decoder hangs at cuvidMapVideoFrame for a lone time

Hi,

I currently have a question about the decoding part. I run the code on my Titan X and realize the decoding part takes more than 10ms to decode one frame. So I go check the decode.c line by line. I found that the code will hang at cuvidMapVideoFrame() for around 8ms, which doesn't make sense to me. Do you have any idea to fix this problem? Thanks!

(c)cmake error - file failed to rename

During subsequent runs with (c)cmake (3.6.0) , I get this error:

CMake Error at CMakeLists.txt:44 (file):
  file COPY cannot find "/home/tomas/projects/NvPipe/nvEncodeAPI-v5.h".

CMake Error at CMakeLists.txt:50 (file):
  file RENAME failed to rename

    /home/tomas/projects/NvPipe/nvEncodeAPI-v5.h
  to
    /home/tomas/projects/NvPipe/nvEncodeAPI.h

  because: No such file or directory

It would seem that initial run of cmake renames the file already, e.g. causing subsequent runs fail.
Seems to have been introduced in 5dc7ef2 .

Docker build & failed to create encoder

Hi,

I've installed NvPipe on a a nvidia enabled docker image. But the encoder cannot be created.
CUDA version : 10
Driver: 410.57

NvPipe example application: Comparison of using host/device memory.

Resolution: 3840 x 2160
Codec: H.264
Bitrate: 32 Mbps @ 90 Hz
Resolution: 3840 x 2160

--- Encode from host memory / Decode to host memory ---
Frame | Encode (ms) | Decode (ms) | Size (KB)
Failed to create encoder: Failed to create encoder (LoadNvEncApi : NvEncodeAPIGetMaxSupportedVersion(&version) returned error -315456918 at /root/src/NvPipe/src/NvCodec/NvEncoder/NvEncoder.cpp:86
)
Failed to create decoder: Failed to create decoder (NvDecoder : cuvidCreateVideoParser(&m_hParser, &videoParserParameters) returned error -45206992 at /root/src/NvPipe/src/NvCodec/NvDecoder/NvDecoder.cpp:542
)
Segmentation fault (core dumped)

I also installed NvCodec with this Dockerfile :

RUN apt-get install -y --no-install-recommends unzip curl && \
 VIDEOSDK_DOWNLOAD_SUM=389d5e73b36881b06ca00ea86f0e9c0c312c1646166b96669e8b51324943e213 && \
    curl -fsSL https://developer.download.nvidia.com/compute/redist/VideoCodec/v8.2/NvCodec.zip -O && \
    echo "$VIDEOSDK_DOWNLOAD_SUM  NvCodec.zip" | sha256sum -c - && \
    unzip -j NvCodec.zip \
          NvCodec/NvDecoder/cuviddec.h \
          NvCodec/NvDecoder/nvcuvid.h \
          NvCodec/NvEncoder/nvEncodeAPI.h \
          -d /usr/local/cuda/include && \
    unzip -j NvCodec.zip \
          NvCodec/Lib/linux/stubs/x86_64/libnvcuvid.so \
          NvCodec/Lib/linux/stubs/x86_64/libnvidia-encode.so \
          -d /usr/local/cuda/lib64/stubs && \
    rm NvCodec.zip  
RUN ln -s /usr/local/cuda/lib64/stubs/libnvidia-encode.so /usr/local/cuda/lib64/stubs/libnvidia-encode.so.1
RUN ln -s /usr/local/cuda/lib64/stubs/libnvcuvid.so /usr/local/cuda/lib64/stubs/libnvcuvid.so.1

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.57                 Driver Version: 410.57                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 107...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   41C    P8     5W /  N/A |      0MiB /  8119MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

thank you

NvPipe fails to compile with USE_FFMPEG=ON

Hi,

I'd like to use NvPipe with the x264 FFMPEG backend to support visualization clients with pre-Kepler hardware. Unfortunately, NvPipe master fails to compile as soon as I enable USE_FFMPEG:

NvPipe/build-pristine$ cmake -DUSE_FFMPEG=ON -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda/7.5 ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: /opt/cuda/7.5 (found version "7.5") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- Checking for module 'libavformat'
--   Found libavformat, version 57.56.101
-- Checking for module 'libavcodec'
--   Found libavcodec, version 57.64.101
-- Checking for module 'libavutil'
--   Found libavutil, version 55.34.101
-- Could NOT find EGL (missing:  EGL_LIBRARY EGL_opengl_LIBRARY EGL_INCLUDE_DIR) 
-- Found GLEW: /usr/include  
-- Configuring done
-- Generating done
-- Build files have been written to: NvPipe/build-pristine
NvPipe/build-pristine$ make
[  7%] Building NVCC (Device) object CMakeFiles/nvpipe.dir/convert.o
[ 15%] Building NVCC (Device) object CMakeFiles/nvpipe.dir/util/kernels.o
Scanning dependencies of target nvpipe
[ 23%] Building CXX object CMakeFiles/nvpipe.dir/ffmpeg.cxx.o
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx: In function ‘nvp_impl_t* nvp_create_ffmpeg(bool, uint64_t)’:
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx:135:21: error: invalid conversion from ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t*, size_t, size_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int*, long unsigned int, long unsigned int, nvpipe_format)}’ to ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t*, uint32_t, uint32_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int*, unsigned int, unsigned int, nvpipe_format)}’ [-fpermissive]
     rv->impl.encode = nvp_ffmpeg_encode;
                     ^
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx:137:21: error: invalid conversion from ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t, size_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int, long unsigned int)}’ to ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, uint32_t, uint32_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, unsigned int, unsigned int, nvpipe_format)}’ [-fpermissive]
     rv->impl.decode = nvp_ffmpeg_decode;
                     ^
CMakeFiles/nvpipe.dir/build.make:76: recipe for target 'CMakeFiles/nvpipe.dir/ffmpeg.cxx.o' failed
make[2]: *** [CMakeFiles/nvpipe.dir/ffmpeg.cxx.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/nvpipe.dir/all' failed
make[1]: *** [CMakeFiles/nvpipe.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

There appear to be two main causes: On x86_64 size_t != uint32_t and the internal NvPipe API now expects an extra parameter const nvp_fmt_t format to the decode function. There are two ways to fix the earlier. I decided to change the signature in internal-api.h as follows (I'd meant to attach a patch but github claims it "can't process that file").

diff --git a/decode.c b/decode.c
index c5949fc..94f5133 100644
--- a/decode.c
+++ b/decode.c
@@ -351,7 +351,7 @@ nvp_cuvid_decode(nvpipe* const cdc,
                  const void* const __restrict ibuf,
                  const size_t ibuf_sz,
                  void* const __restrict obuf,
-                 const uint32_t width, const uint32_t height,
+                 const size_t width, const size_t height,
                  nvp_fmt_t format) {
     struct nvp_decoder* nvp = (struct nvp_decoder*)cdc;
     if(nvp->impl.type != DECODER) {
@@ -485,7 +485,7 @@ nvp_cuvid_encode(nvpipe * const __restrict codec,
                  const size_t ibuf_sz,
                  void *const __restrict obuf,
                  size_t* const __restrict obuf_sz,
-                 const uint32_t width, const uint32_t height,
+                 const size_t width, const size_t height,
                  nvp_fmt_t format) {
     (void)codec; (void)ibuf; (void)ibuf_sz;
     (void)obuf; (void)obuf_sz;
diff --git a/ffmpeg.cxx b/ffmpeg.cxx
index 8d40b17..dc38bca 100644
--- a/ffmpeg.cxx
+++ b/ffmpeg.cxx
@@ -94,7 +94,8 @@ nvp_ffmpeg_decode(nvpipe* const __restrict cdc,
                   const void* const __restrict input_buffer,
                   const size_t input_buffer_size,
                   void* const __restrict output_buffer,
-                  size_t width, size_t height) {
+                  size_t width, size_t height,
+				  const nvp_fmt_t format) {
     assert(cdc);
     /* input images must be a power of two */
     if(((width | height) & 1) != 0) {
@@ -104,6 +105,12 @@ nvp_ffmpeg_decode(nvpipe* const __restrict cdc,
     if(input_buffer_size == 0) {
         return NVPIPE_EINVAL;
     }
+
+    /* only RGB input is supported */
+    if(format != NVPIPE_RGB) {
+        return NVPIPE_EINVAL;
+    }
+
     nvpipe_* codec = static_cast<nvpipe_*>(cdc);
 
     NvPipeCodec *codec_ptr = static_cast<NvPipeCodec*>(codec->codec_ptr_);
diff --git a/internal-api.h b/internal-api.h
index d0af9df..00c6397 100644
--- a/internal-api.h
+++ b/internal-api.h
@@ -40,7 +40,7 @@ typedef nvp_err_t (fqn_encode)(
         const size_t ibuf_sz,
         void *const __restrict obuf,
         size_t* const __restrict obuf_sz,
-        const uint32_t width, const uint32_t height,
+        const size_t width, const size_t height,
         nvp_fmt_t format
         );
 typedef nvp_err_t (fqn_bitrate)(nvpipe* codec, uint64_t);
@@ -48,8 +48,8 @@ typedef nvp_err_t (fqn_decode)(
         nvpipe* const __restrict codec,
         const void* const __restrict ibuf, const size_t ibuf_sz,
         void* const __restrict obuf,
-        const uint32_t width, const uint32_t height,
-        nvp_fmt_t format
+        const size_t width, const size_t height,
+        const nvp_fmt_t format
         );
 typedef void (fqn_destroy)(nvpipe* const __restrict);
 

After the above changes NvPipe compiles but an NVPIPE_H264_FFMPEG decoder fails to decode frames encoded by NVPIPE_H264_NV. I believe that's a separate issue (which I'll submit shortly) but I'd still appreciate it if the compilation issue could be fixed properly in NvPipe upstream.

Cheers,

Rene

Interaction with libNPP (might be off topic)

This isn't an issue with NvPipe as such. I've found NvPipe (and some of the NvCodec Utils) quite useful. Thank you for open sourcing your work!

I'm writing an application that decodes, resizes_and_letterboxes (to the size expected by an object classification DNN running on a seperate GPU), and then re-encodes a given video stream on the GPU.

Once the frame is decoded by NvPipe (output format: NVPIPE_UINT8), the device pointer is passed to the following functions from libNPP:
nppiResize_8u_C4R (to resize)
nppiCopyConstBorder_8u_C4R (to letterbox)

The output frame resizing isn't working as expected: the image is entirely in the green spectrum and restricted to the top 1/3 of the frame. Any idea what could be going on? Intuition tells me this is likely a mismatch in formats...

Tried using NVPIPE_RGBA but the libNPP resize functions then proceeded to mess up the frame entirely resulting in mostly noise in the image...

What color format is the frame output by the decoder in? NV12/YUV420?
Any chance you know what format libNPP expects?

Apologies on the slightly off-topic question, but I couldn't find an answer to this anywhere else, and I'm hoping to be able to leverage your expertise with NVDEC (and hopefully libNPP)...

OpenGL Multiple Threads for Rendering and Encoding

Hi,

I have a multi-threaded scenario for video encoding where:

Thread 1:

  • creates OpenGL Context
  • creates/binds a bunch of FBO/Textures
  • reads a bunch of frames
  • starts rendering every frame into a texture

Thread 2

  • reads texture, and uses NvPipe_EncodeTexture() API to encode the frame

However this does not seem to work. I have limited knowledge in OpenGL, and after going through numerous online articles is related to the OpenGL context not being available in Thread 2. Can someone please help me on how to proceed? Ideally for performance, I wanted one thread to render while other to encode.

Thanks.

Making under Code::Blocks

I used cmake to make NvPipe works under Code::Blocks. After making a NvPipe in cmake it created code::blocks project file when I open project and tried to compile it. It shows me errors:

CMakeFiles\NvPipe.dir\build.make|69|recipe for target 'CMakeFiles/NvPipe.dir/src/NvCodec/Utils/NvPipe_generated_ColorSpace.cu.obj' failed| CMakeFiles\Makefile2|145|recipe for target 'CMakeFiles/NvPipe.dir/all' failed| C:\Users\admin\Downloads\NvPipe-master\Makefile|128|recipe for target 'all' failed|

Stream encoded frame with ffmpeg - no existing PPS 0 referenced

Hello,

at first many thanks to this awesome project!
I want to encode frames from camera and stream them via RTP using FFmpeg. I adapted my code from the FFmpegStreamer class from src/NvCodec/Utils (code below).

When I first start ffplay with
ffplay test.sdp -protocol_whitelist file,udp,rtp
and then immediatly start the stream, it works, and I see the dummy image. The output of ffplay is then

Input #0, sdp, from 'test.sdp':    0KB vq=    0KB sq=    0B f=0/0   
  Metadata:
    title           : No Name
  Duration: N/A, start: 0.199333, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr, 90k tbn, 60 tbc
   5.06 M-V: -0.061 fd=   6 aq=    0KB vq=    0KB sq=    0B f=1/1  

But when I first start the streaming, or wait too long, I get the following (repeating) output from ffplay:

[h264 @ 0x7f3c6c007e80] decode_slice_header error
[h264 @ 0x7f3c6c007e80] non-existing PPS 0 referenced
[h264 @ 0x7f3c6c007e80] decode_slice_header error
[h264 @ 0x7f3c6c007e80] non-existing PPS 0 referenced
[h264 @ 0x7f3c6c007e80] decode_slice_header error
[h264 @ 0x7f3c6c007e80] non-existing PPS 0 referenced
[h264 @ 0x7f3c6c007e80] decode_slice_header error
[h264 @ 0x7f3c6c007e80] no frame!
[h264 @ 0x7f3c6c007e80] non-existing PPS 0 referenced    0B f=0/0   
    Last message repeated 1 times

It seems like I dont set the frame keywords correctly (see also). Do you have any idea how to fix this, how to extract the information out of the encoder? Is it related to this line

 if(!memcmp(compressed.data(), "\x00\x00\x00\x01\x67", 5)) {
    pkt->flags |= AV_PKT_FLAG_KEY;
}

I know its not necessarily an issue of NvPipe, but the FFmpegStreamer is from this project and it is related to the output of the encoder. Might be related to #32.
Another question: Does your NvPipe Encoder use a buffer like the nvidia codec sdk samples? Or does it immediately produce an output for every input frame?

Thank you very much in advance.

My code:

// uses dummy frame like the example file.cpp 

// init encoder
AVPacket *pkt = new AVPacket();
NvPipe* encoder = NvPipe_CreateEncoder(NVPIPE_BGRA32, codec, NVPIPE_LOSSY, bitrateMbps * 1000 * 1000, targetFPS);
if (!encoder)
     std::cerr << "Failed to create encoder: " << NvPipe_GetError(NULL) << std::endl;

// init stream output
std::string str = "rtp://127.0.0.1:49990";
AVOutputFormat *output_format = nullptr; /**< Context specifying output format*/
AVFormatContext *output_format_ctx = nullptr; /**< Context specifying output format context*/
AVStream* stream; /**< The video stream informations*/
output_format = av_guess_format("rtp", nullptr, nullptr);
output_format_ctx = avformat_alloc_context();
avformat_alloc_output_context2(&output_format_ctx, output_format, output_format->name, str.c_str());

// open output url
if (!(output_format->flags & AVFMT_NOFILE)){
     ret = avio_open(&output_format_ctx->pb, str.c_str(), AVIO_FLAG_WRITE);
     if (ret < 0) {
         qFatal("Could not open url");
     }
}

output_format_ctx->oformat = output_format;
output_format->video_codec = AV_CODEC_ID_H264;

stream  = avformat_new_stream(output_format_ctx,nullptr);
stream->id = 0;
stream->codecpar->codec_id = AV_CODEC_ID_H264;
stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
stream->codecpar->width = mData->width_out;
stream->codecpar->height = mData->height_out;
stream->time_base.den = 1;
stream->time_base.num = 30; // 30fps


/* Write the header */
ret = avformat_write_header(output_format_ctx, nullptr);
if (ret != AVSTREAM_INIT_IN_WRITE_HEADER){
    qFatal("Header could not be written correctly!");
}


// encoding and streaming - this runs in a loop
const uint32_t width = 640;
const uint32_t height = 480;

std::vector<uint8_t> rgba(width * height * 4);
std::vector<uint8_t> compressed(rgba.size());

// Encoding
// Construct dummy frame
for (uint32_t y = 0; y < height; ++y)
    for (uint32_t x = 0; x < width; ++x)
        rgba[4 * (y * width + x) + 1] = (255.0f * x* y) / (width * height) * (y % 100 < 50);

uint64_t size = NvPipe_Encode(encoder, rgba.data(), width * 4, compressed.data(), compressed.size(), width, height, false);

if (0 == size)
    std::cerr << "Encode error: " << NvPipe_GetError(encoder) << std::endl;

av_init_packet(pkt);
pkt->data = compressed.data();
pkt->size = size;
pkt->pts = frameCnt;

if(!memcmp(compressed.data(), "\x00\x00\x00\x01\x67", 5)) {
    pkt->flags |= AV_PKT_FLAG_KEY;
}

//stream
fflush(stdout);

// Write the compressed frame into the output
pkt->pts = av_rescale_q(mData->frameCnt_out, AVRational {1, 30}, stream->time_base);
pkt->dts = pkt->pts;
pkt->stream_index = stream->index;

/* Write the data on the packet to the output format  */
//int ret = av_interleaved_write_frame(output_format_ctx, pkt);
int ret = av_write_frame(output_format_ctx, pkt);
av_write_frame(output_format_ctx, NULL);

if (ret < 0) {
    qDebug() << "FFMPEG: Error while writing video frame";
}

/* Reset the packet */
av_packet_unref(pkt); 

The .sdp file to open the stream with ffplay looks like this:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 58.18.101
m=video 49990 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1

Edit: I also get this ffplay output and blocking:

[h264 @ 0x7f78e0049700] concealing 280 DC, 280 AC, 280 MV errors in P frame
[h264 @ 0x7f78e0264a40] concealing 280 DC, 280 AC, 280 MV errors in P frame
[h264 @ 0x7f78e0049700] Invalid NAL unit 5, skipping.    0B f=1/1   
[h264 @ 0x7f78e026b400] concealing 280 DC, 280 AC, 280 MV errors in P frame
[h264 @ 0x7f78e0049700] Invalid NAL unit 5, skipping.    0B f=1/1  

Some of this blocking artefacts are getting very heavy for some images... (Images are screenshots)
original
compressed

NAL type of output bitstream buffer

Hi. I am trying to understand your encoder's logic. Most of the stuff makes sense to me.
But could you please comment on this part?

/* This NAL signals the end of this packet; you might semi-correctly think of
* this as an h264 frame boundary. /
```
uint8_t
nal = ((uint8_t*)obuf) + bitlock.bitstreamSizeInBytes;
nal[0] = nal[1] = 0;
nal[2] = 1;
nal[3] = 9;
nal[4] = nal[5] = nal[6] = 0;
nal[7] = 1;
nal[8] = 9;
nal[9] = 0;

I mean, what type of NALU exactly is that? And is it required for all transfer protocols when streaming via network? 

Thanks!

Encoding glitch while using two concurrent encoder instances

Hey,

I've used the encoder in my Unity application to stream frames to Hololens. It works fine when I use one encoder instance. But when I connect two hololenses, the second encoder sends glitchy output.

The second encoder output : (Decoded with ffmpeg)
holocap

The first encoder output: (Decoded with ffmpeg)
holocap2

No matter the order in which I connect the devices its always the second one that fails. I'm fairly positive that it should be an issue with the nvpipe as I was able to run two encoders in parallel using the older version of the code ( nvp_err_t encodeStatus = nvpipe_encode( ... )without any issues. And I've not changed any code apart from nvpipe.

Also I have verified I can run two encoder instances (REF - https://developer.nvidia.com/video-encode-decode-gpu-support-matrix ) and I get an access violation if I try to connect three..

Any help greatly appreciated.

Thank you
-Rohit

Client video output lags behind after upgrade to new NvPipe

Hi all,

I recently had to upgrade to CUDA 9.1 (due to a segfault in NVCC; sigh) and thus also had to migrate to the CUDA 9 rewrite of NvPipe (78d96af). My setup consists of a server that encodes RGBA frames using NvPipe and sends H264 encoded frames to a visualization client that does the decoding using FFMPEG. This was working fine with CUDA 8.0 and the old NvPipe.

After the upgrade to the new NvPipe (and converting my code to the new API) the client output lags behind by about a frame. The first frame is encoded on the server, the client receives a video packet, passes it to FFMPEG but the frame callback (for decoded frames) is only called after the second video packet has arrived and been passed to FFMPEG.

Is there any way to restore the old behavior?

Cheers,

Rene

Compilation without GL context

Hi,
I have been using NvPipe for some time to encode and stream images from a cluster.
Since the last update of the library, I can no longer compile it on the cluster because it requires an openGL configuration and no graphical environment is installed on the machine. How can I compile NvPipe again on a cluster without any graphical environment?

I will take this opportunity to ask another question.
Before the update, it was possible to specify the path of the Video Codec SDK but there is no more this option at compile time. Is the SDK directly integrated into NvPipe?

libNvPipe.so.1.0.0: undefined reference to `cuvidReconfigureDecoder', 'cuvidGetDecodeStatus'

Basically it compiles NvPipe, but fails when compiling the examples. Am I doing it wrong? Any other output you'd like to see?

Running on Cuda 9.0. Added the following to NvPipe/CMakeLists.txt (at the top) since I was getting warnings about cmake not being able to find them:

SET(EGL_LIBRARY "/usr/lib/nvidia-384/libEGL.so")
SET(EGL_opengl_LIBRARY "/usr/lib/nvidia-384/libOpenGL.so")
SET(EGL_INCLUDE_DIR "/usr/lib/nvidia-384/")

When trying to build:

t@mpt:~/build$ nvidia-smi
Mon Jan 28 20:06:16 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130                Driver Version: 384.130                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro 4000         Off  | 00000000:03:00.0 Off |                  N/A |
| 40%   41C    P0    N/A /  N/A |      0MiB /  1984MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
t@mpt:~/build$ export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
t@mpt:~/build$ export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
t@mpt:~/build$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
t@mpt:~/build$ cd ..
t@mpt:~$ rm -rf build/
t@mpt:~$ mkdir build && cd build
t@mpt:~/build$ cmake /home/t/NvPipe/
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-9.1 (found version "9.1")
-- Found EGL: /usr/lib/nvidia-384/libEGL.so
-- Could NOT find GLEW (missing:  GLEW_INCLUDE_DIR GLEW_LIBRARY)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/t/build
t@mpt:~/build$ make
[  8%] Building NVCC (Device) object CMakeFiles/NvPipe.dir/src/NvCodec/Utils/NvPipe_generated_ColorSpace.cu.o
[ 16%] Building NVCC (Device) object CMakeFiles/NvPipe.dir/src/NvPipe_generated_NvPipe.cu.o
/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1252): warning: signed bit field of length 1

/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1254): warning: signed bit field of length 1

/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1255): warning: signed bit field of length 1

/home/t/NvPipe/src/NvPipe.cu(402): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(407): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(572): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(573): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1252): warning: signed bit field of length 1

/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1254): warning: signed bit field of length 1

/home/t/NvPipe/src/NvCodec/NvEncoder/nvEncodeAPI.h(1255): warning: signed bit field of length 1

/home/t/NvPipe/src/NvPipe.cu(402): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(407): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(572): warning: integer conversion resulted in a change of sign

/home/t/NvPipe/src/NvPipe.cu(573): warning: integer conversion resulted in a change of sign

Scanning dependencies of target NvPipe
[ 25%] Building CXX object CMakeFiles/NvPipe.dir/src/NvCodec/NvEncoder/NvEncoder.cpp.o
[ 33%] Building CXX object CMakeFiles/NvPipe.dir/src/NvCodec/NvEncoder/NvEncoderCuda.cpp.o
[ 41%] Building CXX object CMakeFiles/NvPipe.dir/src/NvCodec/NvDecoder/NvDecoder.cpp.o
[ 50%] Linking CXX shared library libNvPipe.so
[ 50%] Built target NvPipe
Scanning dependencies of target nvpExampleFile
[ 58%] Building CXX object CMakeFiles/nvpExampleFile.dir/examples/file.cpp.o
[ 66%] Linking CXX executable nvpExampleFile
libNvPipe.so.1.0.0: undefined reference to `cuvidReconfigureDecoder'
libNvPipe.so.1.0.0: undefined reference to `cuvidGetDecodeStatus'
collect2: error: ld returned 1 exit status
CMakeFiles/nvpExampleFile.dir/build.make:100: recipe for target 'nvpExampleFile' failed
make[2]: *** [nvpExampleFile] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/nvpExampleFile.dir/all' failed
make[1]: *** [CMakeFiles/nvpExampleFile.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
t@mpt:~/build$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.