Create a C++ console application in Visual Studio#

This topic describes the steps needed to configure a C++ console application in Visual Studio.

Create the Visual Studio project#

  1. Create a Visual C++, Win32 Console Application in Visual Studio 2015. Name the project ‘SimpleConverter’.

  2. Download the 64 bit version of AVBlocks for C++ (Windows). The file you need will have a name similar to - the version number may differ.

  3. Unzip in a location of your choice, then copy the include and lib directories to the project directory.

  4. Add AVBlocks.h and AVBlocks64.lib to stdafx.h:

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

// TODO: reference additional headers your program requires here

// the main AVBlocks header
#include "include\AVBlocks.h"

// needed for C++11 features
#include "include\PrimoReference++.h"

// link with AVBlocks64.lib
#pragma comment(lib, "lib\\AVBlocks64.lib")
  1. In Visual Studio, select ‘BUILD | Configuration Manager’ from the menu, then add the ‘x64’ platform to the solution platforms.

  2. Build the project.

  3. Copy the file AVBlocks64.dll from lib to x64\Debug.

  4. Replace the contents of ‘SimpleConverter.cpp’ with this code:

// SimpleConverter.cpp : Defines the entry point for the console application.

#include "stdafx.h"

using namespace primo::codecs;
using namespace primo::avblocks;

int _tmain(int argc, _TCHAR* argv[])
    // needed for WMV
    CoInitializeEx(nullptr, COINITBASE_MULTITHREADED);


    auto inputInfo = primo::make_ref(Library::createMediaInfo());

    if (inputInfo->load()) {
        auto inputSocket = primo::make_ref(Library::createMediaSocket(inputInfo.get()));
        auto outputSocket = primo::make_ref(Library::createMediaSocket(Preset::iPad_H264_720p));

        auto transcoder = primo::make_ref(Library::createTranscoder());

        if (transcoder->open()) {



    return 0;

Run the application#

  1. Download the Wildlife.wmv HD movie from the Internet Archive and save it in the project directory.

  2. Run the application in Visual Studio. Wait a few seconds for the Transcoder to finish. The converted file Wildlife.mp4 will be in the project directory.


  • You may get “The program can’t start because AVBlocks64.dll is missing from your computer. Try reinstalling the program to fix this problem.” or a similar message. To fix that, copy the file AVBlocks64.dll from lib to x64\Debug.

  • transcoder->open() may fail if there is already a file Wildlife.mp4 in the project directory. Delete Wildlife.mp4 to solve that.