how to display a video file on my PC

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

how to display a video file on my PC

PostWed Apr 06, 2016 7:48 am

Hi all, i have a video file on my PC, how can i display it using Decklink SDK? I try VancOutput example, but i think this example display a blue screen only 1 time. i use while (1) to display many time but error.
help me please,
thank you
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

Re: how to display a video file on my PC

PostFri Apr 22, 2016 2:58 am

no one can help me???
Offline
User avatar

Richard Courtney

  • Posts: 347
  • Joined: Wed Aug 22, 2012 2:50 pm

Re: how to display a video file on my PC

PostMon Apr 25, 2016 12:53 am

Which Decklink card?
Which language (c++. C#, etc) do you write in?
Which OS?
Which codec was used to capture the video file?
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

Re: how to display a video file on my PC

PostMon Apr 25, 2016 7:52 am

Hi Richard Courtney,
+ Im using DeckLink Optical Fiber, this "http://www.bhphotovideo.com/c/product/620812-REG/Blackmagic_Design_BDLKOPT_DeckLink_Optical_Fiber.html".
+ I write in C++, using Decklink SDK 10.6.4
+ I use with Visual Studio in Windows
+ I dont use codec
+ I use Decklink SDK, with "VancOutput" example. i add opencv to capture a video on my PC and display it on a monitor through out put of DeckLink Optical Fiber, but i only display 1 frame of video, i cant display all frame of video, its error. can you help me with this or do you have a way to display video with this DeckLink Optical Fiber.
Hope to see your answer,
thank you so much!
Offline
User avatar

Richard Courtney

  • Posts: 347
  • Joined: Wed Aug 22, 2012 2:50 pm

Re: how to display a video file on my PC

PostMon Apr 25, 2016 2:18 pm

My license for Visual Studio Professional expired so I can't do testing with you.
For work I am running Linux and use Qt MinGw C++.

Does Media Express play this file?

Can you open Blackmagic Design Control Panel and post your settings for this card?
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

Re: how to display a video file on my PC

PostTue Apr 26, 2016 6:54 am

+ Media Express can not play that file, because "audio sample rate is not support, audio sample rate needs to be 48 khz".
+ I dont setting any thing and dont use Media Express. I only use Decklink SDK, with "VancOutput" example. This example show a blue screen on my monitor, i add opencv on Visual Studio then i can show a picture, now i capture frame from video file but i cant show its, i have error "Could not schedule video frame".
+ Can you help me with this, please.
Thank you so much.
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

Re: how to display a video file on my PC

PostWed Apr 27, 2016 9:06 am

help me, please !!!
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: how to display a video file on my PC

PostWed Apr 27, 2016 10:37 am

More information is needed. For example, how have you modified the VANC sample? It is supposed to show blue frames with VANC data. Have you demultiplexed/decoded your video file? What format is your video frame in? Does it match a BMD pixel mode? What is your frame size? Does it match a broadcast resolution? Have you set the correct pixel mode and TV mode? There is nowhere near enough information to offer any help.

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline
User avatar

Richard Courtney

  • Posts: 347
  • Joined: Wed Aug 22, 2012 2:50 pm

Re: how to display a video file on my PC

PostFri Apr 29, 2016 4:00 am

Dave is right, we need more info. Can you post a few seconds of your video test file?

In VancOutput.cpp you need to set the parameters to match your video file.

#include "platform.h"

// Video mode parameters
const BMDDisplayMode kDisplayMode = bmdModeHD1080i50;
const BMDVideoOutputFlags kOutputFlag = bmdVideoOutputVANC;
const BMDPixelFormat kPixelFormat = bmdFormat10BitYUV;

// Frame parameters
const INT32_UNSIGNED kFrameDuration = 1000;
const INT32_UNSIGNED kTimeScale = 25000;
const INT32_UNSIGNED kFrameWidth = 1920;
const INT32_UNSIGNED kFrameHeight = 1080;
const INT32_UNSIGNED kRowBytes = 5120;


etc using the SDK Manual
Offline

Thanh Son

  • Posts: 10
  • Joined: Tue Mar 15, 2016 7:17 am

Re: how to display a video file on my PC

PostFri Apr 29, 2016 6:45 am

thanks all,
+ that vancoutput example show only a blue frame 1 time right?, i only add while(1) to show that blue frame many time, but error, here some code, i dont edit more, just only add while(1)
// Enable video output
result = deckLinkOutput->EnableVideoOutput(kDisplayMode, kOutputFlag);
if(result != S_OK)
{
fprintf(stderr, "Could not enable video output - result = %08x\n", result);
goto bail;
}
while(1)
{
// Create a frame with defined format
videoFrameBlue = CreateFrame(deckLinkOutput);

// Schedule a blue frame 3 times
for(int i = 0; i < 3; i++)
{
result = deckLinkOutput->ScheduleVideoFrame(videoFrameBlue, gTotalFramesScheduled*kFrameDuration, kFrameDuration, kTimeScale);
if(result != S_OK)
{
fprintf(stderr, "Could not schedule video frame - result = %08x\n", result);
goto bail;
}
gTotalFramesScheduled ++;
}

// Start
result = deckLinkOutput->StartScheduledPlayback(0, kTimeScale, 1.0);
if(result != S_OK)
{
fprintf(stderr, "Could not start - result = %08x\n", result);
goto bail;
}

// Wait until user presses Enter
printf("Monitoring... Press <RETURN> to exit\n");

getchar();

printf("Exiting.\n");
}
i have error "Could not schedule video frame", i dont know what make this error and how to fix it.
Offline
User avatar

Richard Courtney

  • Posts: 347
  • Joined: Wed Aug 22, 2012 2:50 pm

Re: how to display a video file on my PC

PostFri Apr 29, 2016 12:01 pm

I think it only builds the frame buffer once and then reschedules to
send it out. Make sure you are not blocking your execution
loop or you will not see vanc data/new frames.

EDIT: Looking at the original source code I do not see where your while loop is.
The VANC example is just looking to show you how to use the VANC output to control your camera.
It is not a video player. Does your camera see the data?

Also, using the Desktop Video Utility make all channels output for testing.
If channel was in use should have received the error message.
Offline

Nicholas Gill

Blackmagic Design

  • Posts: 169
  • Joined: Mon May 04, 2015 10:28 pm

Re: how to display a video file on my PC

PostWed May 04, 2016 5:02 am

Hi Son,

Please see SDK Manual chapter "2.4.2 Playback" for a high-level overview of how to perform a playback operation.

Generally, to play back a video file, an application will read video frames from disk, and in the IDeckLinkVideoOutputCallback::ScheduledFrameCompleted[1] callback update the IDeckLinkVideoFrame[2] buffer[3] for the provided video frame and schedule[4] that frame for playback.

I have included section "2.4.2 Playback" below.

Cheers,

-nick

[1] 2.5.6.1 IDeckLinkVideoOutputCallback::ScheduledFrameCompleted method
[2] 2.5.5 IDeckLinkVideoFrame Interface
[3] 2.5.5.6 IDeckLinkVideoFrame::GetBytes method
[4] 2.5.3.11 IDeckLinkOutput::ScheduleVideoFrame method


2.4.2 Playback
An application performing a standard streaming playback operation should perform the following steps:

IDeckLinkOutput::DoesSupportVideoMode to check if the combination of the video mode and pixel format is supported.
IDeckLinkOutput::EnableVideoOutput
IDeckLinkOutput::EnableAudioOutput
IDeckLinkOutput::SetScheduledFrameCompletionCallback
IDeckLinkOutput::SetAudioCallback
IDeckLinkOutput::BeginAudioPreroll
• While more frames or audio need to be pre-rolled:
- IDeckLinkOutput::ScheduleVideoFrame
- Return audio data from IDeckLinkAudioOutputCallback::RenderAudioSamples
- When audio preroll is complete, call IDeckLinkOutput::EndAudioPreroll
IDeckLinkOutput::StartScheduledPlayback
• While playback is running:
- Schedule more video frames from IDeckLinkVideoOutputCallback::ScheduledFrameCompleted
- Schedule more audio from IDeckLinkAudioOutputCallback::RenderAudioSamples

If audio is not required, the call to IDeckLinkOutput::EnableAudioOutput,
IDeckLinkOutput::SetAudioCallback and IDeckLinkOutput::BeginAudioPreroll may be omitted.
If pre-roll is not required initial IDeckLinkOutput::ScheduleVideoFrame calls and the call to IDeckLinkOutput::BeginAudioPreroll and IDeckLinkOutput::EndAudioPreroll may be omitted.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 12 guests