Home > Archive (Community help, from old helpdesk) > Convert a JPG to video with supplied WAV file for audio?

Convert a JPG to video with supplied WAV file for audio?

Avatar image
Aug 23, 2015
Archive Agent wrote
I couldn’t get the JPG to video example to work after watching the video using the C# source code for the editor SDK so I’m not sure if this is easy/possible or not – all I want to do is take a single .JPG file and have it create a video using an existing WAV file recording I already have – I want the video to consist of a static show of the JPG and play the audio track till complete. Poking around with the editor options I’m not seeing a way to provide an existing audio track to do this unless I’m missing something obvious?
thanks

Jeff Lindborg on January 04, 2014 20:10
Completed
0
Vote
Reply
9 Answers
Aug 23, 2015
Archive Agent agent wrote
Jeff Lindborg

Just for more detail – I was trying to play with the image-to-video example using the console example here: http://support.visioforge.com/knowledgebase/articles/234549-video-from-images-in-console-application-using-vid

Followed the example exactly, just passing in a single .JPG file (softblue.jpg from the Microsoft shared files folder) – when the play is executed it throws an error: “GetGroupOutputPin: Operation failed because project was not rendered successfully.”

Not sure what that means – I tried using a VideoEdit control on the form itself instead of using the console/slave control and it throws the same error. Tried some different .JPG files and a few .GIFs I had laying around and it’s always the same error.

Is this perhaps something that is not allowed in the demo mode?

on January 05, 2014 20:04
Aug 23, 2015
Archive Agent agent wrote
Jeff Lindborg

Here’s the entire code for my little test console application (yes, SoftBlue.jpg is in c: - I can send you the file if needed):

[STAThread]
static void Main()
{
const string outputFilename = "c:\\testvideo.avi";
if (File.Exists(outputFilename))
{
File.Delete(outputFilename);
}

VisioForge.Controls.VideoEdit.VideoEditSlave videoEdit1 = new VisioForge.Controls.VideoEdit.VideoEditSlave();

videoEdit1.Input_AddImageFile("c:\\SoftBlue.jpg", 2000, 0, VFVideoEditStretchMode.Letterbox);
videoEdit1.Video_Effects_Clear();
videoEdit1.Mode = VisioForge.Types.VFVideoEditMode.Convert;

videoEdit1.Video_Resize = true;
videoEdit1.Video_Resize_Width = 640;
videoEdit1.Video_Resize_Height = 480;

videoEdit1.Video_FrameRate = 25;
videoEdit1.Video_Renderer = VisioForge.Types.VFVideoRenderer.None;
videoEdit1.Screen_Stretch = false;

videoEdit1.Output_Format = VFVideoEditOutputFormat.AVI;
videoEdit1.Output_Filename = outputFilename;

videoEdit1.Audio_Codec_Name = "PCM";
videoEdit1.Audio_Codec_Channels = 1;
videoEdit1.Audio_Codec_BPS = 16;
videoEdit1.Audio_Codec_SampleRate = 48000;
videoEdit1.Video_Codec = "MJPEG Compressor";
videoEdit1.Audio_LAME_UseInAVI = false;

videoEdit1.Audio_Preview_Enabled = true;

videoEdit1.Audio_Effects_Clear(-1);
videoEdit1.Audio_Effects_Enabled = false;
videoEdit1.Video_Effects_Enabled = true;
videoEdit1.Video_Effects_Clear();

videoEdit1.Video_Effects_Deinterlace_CAVT(1, 0, 0, true, Convert.ToByte("20"));

videoEdit1.OnError += VideoEdit1_OnError;
videoEdit1.OnProgress += VeOnOnProgress;

videoEdit1.ConsoleUsage = true;

videoEdit1.Start();

while (videoEdit1.Status == VFVideoEditStatus.Work)
{
Console.WriteLine(videoEdit1.Progress());
Console.WriteLine(videoEdit1.Duration());
Console.WriteLine(videoEdit1.Status);

Thread.Sleep(1000);
}

Console.WriteLine("Done!");
}

private static void VeOnOnProgress(object sender, ProgressEventArgs progressEventArgs)
{
Console.WriteLine(progressEventArgs.Progress);
}

private static void VideoEdit1_OnError(object sender, ErrorsEventArgs e)
{
Console.WriteLine(e.Message);
}

on January 05, 2014 20:33
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

I think C:\outputvideo.avi is not available for writing, please save video to My Documents folder.

Yes, please send me an image.

on January 06, 2014 12:53
Aug 23, 2015
Archive Agent agent wrote
Jeff Lindborg

c:\ is available to write (it's Win7 and I'm running as admin) - I've been testing all your libraries outputting to there and they all work fine. But I did use a temp file in the users/jlindborg/... path as well, same error.
I tried numerous image files - but I'll send you the softblue.jpg anyway...

on January 06, 2014 18:03
Aug 23, 2015
Archive Agent agent wrote
Jeff Lindborg

hmmm... I thought there was a way to attach a file in the threading here but I don't see it - is there an email address or a location to provide files?

on January 06, 2014 18:07
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

please send it to support@visioforge.com

on January 07, 2014 18:38
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

in you code i don't see how you are added audio file... so, you must add audio file or disable audio stream encoding

on January 07, 2014 18:39
Aug 23, 2015
Archive Agent agent wrote
Jeff Lindborg

I sent the JPG file.

I’m just following your example for creating a video using the command line application version:
http://support.visioforge.com/knowledgebase/articles/234549-video-from-images-in-console-application-using-vid

it makes no mention of adding an audio file – so I’m unsure what the purpose of the example is if it’s missing some critical piece of functionality necessary to make it work – there should be at least a comment in there directing users to follow up on it.

If you have a fully working example in .NET for how to convert a .JPG into a video (with or without an audio file) I'd like to see it...

on January 07, 2014 20:11
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Replied privately.

on January 08, 2014 15:34