Question

Code for Converting different video format files to Mpeg format

Asked by: LTIndia

I want to write some code for converting different video files to mpeg format to create VCD/ DVD.This can be divided into two tasks:
1) Conversion of different file formats to Mpeg format
2) Writing these files to CD/DVD to be playable in any player.

Now for 1st part:
I need code to convert different video formats to mpeg format.
The problem is that i am unable to get any sample code that could help me how to do that.
I am not very much sure but i suppose this can be done using:
i) FFMpeg API
ii) DirectX API (not pretty much sure)
iii) QuickTime API (not pretty much sure for Video Conversion)

Taking i)
I have downloaded the FFMpeg project code through SVN, but that didnt helped me much, as i want only the conversion related code from that and i am not sure how to approach for this.

Taking ii)
 I am not very much sure  about this but i guess there might be some way of doing this. I want to know is there any way of doing this task of conversion using DirectX SDK? if so then how(code)?

Taking iii)
I am not very much sure  about video conversion, but i m considering as it provide good support for audio conversions. I want to know is there any wayvideoconversion using Quicktime? if so then how(code)?

Now the 2nd part: VCD/DVD Writing
As explained above i want to create VCD/DVD from the mpeg files(if OK to use this format).
I dont know how to do this as i suppose IMAPI2 doesnt provide anything like TrackAtOnce for videoCD/ DVD writing.
Watever i think ineed to create some hierarical structure for this and remove headers from mpeg files for creation of stream to be passed to DiscBurner.

I am not sure how much i am right ................
Sorry for that long  question but i want to tell u experts what i know so i could provide u much information about my problem.
and get a better response asap.
 
Thanks in advance
Tarun
 

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-09-02 at 06:38:56ID23695922
Tags

MICROSOFT, Apple, GNU

,

DirectX, IMAPI2, QuickTime, FFMPEG

,

C++/ MFC

Topics

Video Editing

,

Windows MFC Programming

Participating Experts
2
Points
500
Comments
10

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. MPEG Video
    i have a dos mpeg video player. iw ant to know how a mpeg file is read and displayed. can this be done in c. if yes how.
  2. MPEG 4
    Hi everyone Is there a DVD player that can play codec MPEG 4 video files on a TV?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: GurudenisPosted on 2008-09-03 at 01:03:18ID: 22374918

Try using mencoder:
http://www.mplayerhq.hu/
It has plenty of useful command line switches and verbose output. Therefore it can be controlled and monitored programmatically. I've done this before, and I can tell you that mencoder does the job pretty well.

 

by: LTIndiaPosted on 2008-09-03 at 04:28:58ID: 22376010

Thanx for d response. But i cant find way to do that :(
btw  what i want is get some API sort of thing  to do the conversion that i can embed within my code.
Any code  sample would be of great help!!!!!

 

by: GurudenisPosted on 2008-09-03 at 04:45:48ID: 22376111

In my case, I made a library that wrapped up CreateProcess and stdout redirection with anonymous pipes. Suggest you do the same. To the client of your library, it'll look like there's no separate console application (mencoder), like your library is doing everything on its own.

 

by: LTIndiaPosted on 2008-09-08 at 07:00:50ID: 22417359

thanks  Mr. GuruDenis for your kind response, but what i want to do is  s get some API sort of thing  to do the conversion that i can embed within my code.
Any code  sample would be of great help!!!!!
This might be the next option(also not really sure how to do that).Can you p[lz show me how to do that this might help me if nothing else work out)

 

by: GurudenisPosted on 2008-09-08 at 07:39:33ID: 22417821

>> Can you p[lz show me how to do that this might help me if nothing else work out)
I'm afraid that I cannot publish this code entirely because it's owned by my employer, while a short snippet will hardly be enough to demonstrate the concept. The idea, however, is to start mencoder.exe with command line parameters that match the desired output format, that's all. If you need to monitor conversion progress, mencoder outputs that to standard ouptut, so you can redirect it with CreatePipe and CreateProcess as described here:
http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx

>> i want to do is  s get some API sort of thing
Consider using libavcodec then. It will be sufficiently more complicated than launching mencoder, though. See:
http://en.wikipedia.org/wiki/Libavcodec
http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html

 

by: LTIndiaPosted on 2008-09-12 at 05:14:21ID: 22458910

Thanks Gurudenis, I am now trying to compile  ffmpeg using MINGm/Minsys way to get the lib files.
Now the problem is when i follow the procedure as given in several links, then a problem starts up during compilation the compilation is taking more than 6 hrs. and still not completed.
here is the complete output:

$ ./myconfig            
install prefix            C:/msys/1.0/local
source path               /c/ffmpeg_latest
C compiler                gcc
.align is power-of-two    no
ARCH                      x86_32 (generic)
big-endian                no
yasm                      no
MMX enabled               yes
CMOV enabled              no
CMOV is fast              no
EBX available             yes
EBP available             no
gprof enabled             no
debug symbols             yes
strip symbols             yes
optimizations             yes
static                    yes
shared                    no
postprocessing support    no
software scaler enabled   no
new filter support        no
filters using lavformat   no
video hooking             no
network support           yes
IPv6 support              no
threading support         no
SDL support               no
Sun medialib support      no
AVISynth enabled          no
liba52 support            no
liba52 dlopened           no
libamr-nb support         no
libamr-wb support         no
libdc1394 support         no
libdirac enabled          no
libfaac enabled           no
libfaad enabled           no
libfaad dlopened          no
libgsm enabled            no
libmp3lame enabled        no
libnut enabled            no
libschroedinger enabled   no
libtheora enabled         no
libvorbis enabled         no
libx264 enabled           no
libxvid enabled           no
zlib enabled              no
bzlib enabled             no

Enabled decoders:
aac                     gif                     pcx
aasc                    h261                    ptx
adpcm_4xm               h263                    qdm2
adpcm_adx               h263i                   qdraw
adpcm_ct                h264                    qpeg
adpcm_ea                huffyuv                 qtrle
adpcm_ea_maxis_xa       idcin                   ra_144
adpcm_ea_r1             imc                     ra_288
adpcm_ea_r2             indeo2                  rawvideo
adpcm_ea_r3             indeo3                  rl2
adpcm_ea_xas            interplay_dpcm          roq
adpcm_g726              interplay_video         roq_dpcm
adpcm_ima_amv           jpegls                  rpza
adpcm_ima_dk3           kmvc                    rv10
adpcm_ima_dk4           loco                    rv20
adpcm_ima_ea_eacs       mace3                   sgi
adpcm_ima_ea_sead       mace6                   shorten
adpcm_ima_qt            mdec                    smackaud
adpcm_ima_smjpeg        mimic                   smacker
adpcm_ima_wav           mjpeg                   smc
adpcm_ima_ws            mjpegb                  snow
adpcm_ms                mlp                     sol_dpcm
adpcm_sbpro_2           mmvideo                 sonic
adpcm_sbpro_3           motionpixels            sp5x
adpcm_sbpro_4           mp2                     sunrast
adpcm_swf               mp3                     svq1
adpcm_thp               mp3adu                  svq3
adpcm_xa                mp3on4                  targa
adpcm_yamaha            mpc7                    theora
alac                    mpc8                    thp
amv                     mpeg1video              tiertexseqvideo
ape                     mpeg2video              tiff
asv1                    mpeg4                   truemotion1
asv2                    mpegvideo               truemotion2
atrac3                  msmpeg4v1               truespeech
avs                     msmpeg4v2               tscc
bethsoftvid             msmpeg4v3               tta
bfi                     msrle                   txd
bmp                     msvideo1                ulti
c93                     mszh                    vb
cavs                    nellymoser              vc1
cinepak                 nuv                     vcr1
cljr                    pcm_alaw                vmdaudio
cook                    pcm_dvd                 vmdvideo
cscd                    pcm_f32be               vmnc
cyuv                    pcm_f32le               vorbis
dca                     pcm_f64be               vp3
dnxhd                   pcm_f64le               vp5
dsicinaudio             pcm_mulaw               vp6
dsicinvideo             pcm_s16be               vp6a
dvbsub                  pcm_s16le               vp6f
dvdsub                  pcm_s16le_planar        vqa
dvvideo                 pcm_s24be               wavpack
eacmv                   pcm_s24daud             wmav1
eatgv                   pcm_s24le               wmav2
eightbps                pcm_s32be               wmv1
eightsvx_exp            pcm_s32le               wmv2
eightsvx_fib            pcm_s8                  wmv3
escape124               pcm_u16be               wnv1
ffv1                    pcm_u16le               ws_snd1
ffvhuff                 pcm_u24be               xan_dpcm
flac                    pcm_u24le               xan_wc3
flic                    pcm_u32be               xl
flv                     pcm_u32le               xsub
fourxm                  pcm_u8                  zlib
fraps                   pcm_zork

Enabled encoders:
ac3                     mp2                     pcm_u24le
adpcm_adx               mpeg1video              pcm_u32be
adpcm_g726              mpeg2video              pcm_u32le
adpcm_ima_qt            mpeg4                   pcm_u8
adpcm_ima_wav           msmpeg4v1               pcm_zork
adpcm_ms                msmpeg4v2               pgm
adpcm_swf               msmpeg4v3               pgmyuv
adpcm_yamaha            nellymoser              ppm
alac                    pam                     qtrle
asv1                    pbm                     rawvideo
asv2                    pcm_alaw                roq
bmp                     pcm_f32be               roq_dpcm
dnxhd                   pcm_f32le               rv10
dvbsub                  pcm_f64be               rv20
dvdsub                  pcm_f64le               sgi
dvvideo                 pcm_mulaw               snow
ffv1                    pcm_s16be               sonic
ffvhuff                 pcm_s16le               sonic_ls
flac                    pcm_s24be               svq1
flv                     pcm_s24daud             targa
gif                     pcm_s24le               tiff
h261                    pcm_s32be               vorbis
h263                    pcm_s32le               wmav1
h263p                   pcm_s8                  wmav2
huffyuv                 pcm_u16be               wmv1
jpegls                  pcm_u16le               wmv2
ljpeg                   pcm_u24be               zlib
mjpeg

Enabled parsers:
aac                     dvdsub                  mpeg4video
ac3                     h261                    mpegaudio
cavsvideo               h263                    mpegvideo
dca                     h264                    pnm
dirac                   mjpeg                   vc1
dvbsub                  mlp                     vp3

Enabled demuxers:
aac                     lmlm4                   pcm_u16le
ac3                     m4v                     pcm_u24be
aiff                    matroska                pcm_u24le
amr                     mjpeg                   pcm_u32be
apc                     mlp                     pcm_u32le
ape                     mm                      pcm_u8
asf                     mmf                     pva
au                      mov                     rawvideo
avi                     mp3                     redir
avs                     mpc                     rl2
bethsoftvid             mpc8                    rm
bfi                     mpegps                  roq
c93                     mpegts                  rpl
daud                    mpegtsraw               rtsp
dirac                   mpegvideo               sdp
dsicin                  msnwc_tcp               segafilm
dts                     mtv                     shorten
dv                      mvi                     siff
dxa                     mxf                     smacker
ea                      nsv                     sol
ea_cdata                nut                     str
eac3                    nuv                     swf
ffm                     ogg                     thp
flac                    oma                     tiertexseq
flic                    pcm_alaw                tta
flv                     pcm_f32be               txd
fourxm                  pcm_f32le               vc1
gsm                     pcm_f64be               vc1t
gxf                     pcm_f64le               vmd
h261                    pcm_mulaw               voc
h263                    pcm_s16be               wav
h264                    pcm_s16le               wc3
idcin                   pcm_s24be               wsaud
iff                     pcm_s24le               wsvqa
image2                  pcm_s32be               wv
image2pipe              pcm_s32le               xa
ingenient               pcm_s8                  yuv4mpegpipe
ipmovie                 pcm_u16be

Enabled muxers:
ac3                     m4v                     pcm_mulaw
adts                    matroska                pcm_s16be
aiff                    matroska_audio          pcm_s16le
amr                     mjpeg                   pcm_s24be
asf                     mmf                     pcm_s24le
asf_stream              mov                     pcm_s32be
au                      mp2                     pcm_s32le
avi                     mp3                     pcm_s8
avm2                    mp4                     pcm_u16be
crc                     mpeg1system             pcm_u16le
daud                    mpeg1vcd                pcm_u24be
dirac                   mpeg1video              pcm_u24le
dts                     mpeg2dvd                pcm_u32be
dv                      mpeg2svcd               pcm_u32le
eac3                    mpeg2video              pcm_u8
ffm                     mpeg2vob                psp
flac                    mpegts                  rawvideo
flv                     mpjpeg                  rm
framecrc                mxf                     roq
gif                     null                    rtp
gxf                     nut                     swf
h261                    ogg                     tg2
h263                    pcm_alaw                tgp
h264                    pcm_f32be               vc1t
image2                  pcm_f32le               voc
image2pipe              pcm_f64be               wav
ipod                    pcm_f64le               yuv4mpegpipe

Enabled protocols:
file                    pipe                    tcp
http                    rtp                     udp

Enabled filters:
crop

Enabled bsfs:
dump_extradata          mov2textsub             noise
h264_mp4toannexb        mp3_header_compress     remove_extradata
imx_dump_header         mp3_header_decompress   text2movsub
mjpega_dump_header

Enabled indevs:
vfwcap

Enabled outdevs:

License: LGPL
Creating config.mak and config.h...




And it hangs here i suppose(alhough the process is taking memmory from my system)..............................

Any Help ...................

 

by: GurudenisPosted on 2008-09-12 at 09:48:20ID: 22461616

This looks like a compiler bug to me because no errors are reported, yet it hangs while creating a mak file (apparently). I'm no expert in MinGW, but I do remember having problems configuring it properly when I had to use it once. Make sure you're using the appropriate home directory and the command line switches are as described here:
http://forum.doom9.org/archive/index.php/t-115753.html

Have you looked for a compiled binary? Have a look at these links, maybe they'll prove useful:
http://www.swindongallery.org.uk/galleryG2DLL/galleryDLL.zip
http://downloads.sourceforge.net/mplayer-win32/FFmpeg-svn-14277.7z?modtime=1216380753&big_mirror=0
http://www.bala-krishna.com/wp-content/uploads/2008/01/ffmpeg-047.zip

Also look for avcodec.dll and avformat.dll (and their lib files) on the web, this is what ffmpeg compiles to.

 

by: LTIndiaPosted on 2008-09-24 at 23:02:36ID: 22566571

THanx Mr GuruDenis,
Sorry for so late reponse......
But stil i m not able to compile FFMPEG.
anyways thanx for ur help, i have downloaded files from  http://arrozcru.no-ip.org/ffmpeg_builds/
and now trying to get something out of it.

 

by: GurudenisPosted on 2008-09-24 at 23:36:32ID: 22566724

Ok, feel free to ask if you encounter problems along the way.

 

by: radeusPosted on 2008-11-05 at 09:33:48ID: 22887703

You should use DirectShow API (part of DirectX) to do this conversion in code. DirectShow is far to large for me to give you example code, but here are the things you would need:
" DirectShow SDK (available from Microsoft for free)
" ffdshow (freeware encode/decode codec for directshow)
" GraphEditPlus (not necessary, but can generate c++ code for you from a graph making life easier)

Bsically, you would be creating a DirectShow graph that has the file you want to convert as the source filter (File Source Async.) then any demux/transform filters required, then ffdshow encoder filter, then any mux required, finally to file writer sink.

Sounds complicated, but its not that hard.

-radeus

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...