Call External programs

This is a discussion on Call External programs within the C Programming forums, part of the General Programming Boards category; Hi People , I trying use a program Called FFMPeg that grab videos directly from my videodevice on linux . ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    7

    Exclamation Call External programs

    Hi People ,

    I trying use a program Called FFMPeg that grab videos directly from my videodevice on linux .

    How can i insert in this code a part to when people put the command line "-T" (it's about time) , after he stop ,launch a external shell script bash (linux) that will reside in the same directory ?

    I mean , i try to use the program for video capture called , only , he is a GNU program then we have the source .
    Very well , i just need when i put the command "-t" , when he finish just lauch another program . (He call a shellbash script resident in same directory with name "starting").

    Can someone help ? I really don't know nothing about C or C++ , but i really need fix this to use here .

    I think that i can't put code in this channel , someone have this program ?? can someone help ? I send the C source .
    It's very easy i think =)

    Looking into the code i see this part when i take out the break command compile and try to use he never stop , then i think this is the part that i must insert the lauch code .


    }
    /* if none, if is finished */
    if (file_index < 0)
    break;

    /* finish if recording time exhausted */

    if (recording_time > 0 && min_pts >= recording_time)
    break; < -- "Think that the code must be here"

    /* read a packet from it and output it in the fifo */

    is = input_files[file_index];
    if (av_read_packet(is, &pkt) < 0) {
    file_table[file_index].eof_reached = 1;
    continue;
    }
    ist_index = file_table[file_index].ist_index + pkt.stream_index;
    ist = ist_table[ist_index];
    if (ist->discard) {
    continue;
    }




    Thanks anyway for helping .

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    En anglais?

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    7

    ???/

    C'mon someone help here ???
    I think that easy ! .
    Anyone can't adventure and answer this poor dummy !!!???
    =)

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    wow

    From what I can make out from your post.....all you wondering is calling an external program? That's simple, it's even delt with at this site. As far as command line paremeters, for callnig a program, that's possible also.

    system("pgm.exe");

    This would be a way of calling an external program. It's only one way however, there aer other ways. I cannot comment on the command line paramter, as I seem to have "forgot" that stuff .
    The world is waiting. I must leave you now.

  5. #5
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    Info on running execs can be found Here
    The system option is probably not the best way to go.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    Shadow i really understant what you fell about this dummy question . Ok .
    But i think that the meaning of every message board is help each other .
    If you know more or less great it's just concern to you =).

    What i request here it's just a help , because i read the FAQ , try it and don't work .
    Then because i don't know nothing about C and really need this solution i think post a message here .


    Anyone with good heart that want help a dummy C user i really will apreciate .

    Anyway i just wonder what i need to do to in this code tha i put above the way to call another program .
    I using this into a Linux Redhat box , the program will call another one in the same directory .

    Can someone look at the code and help-me solution this ?

    The part that i mark it's about when i put the "-t" command he make a count to the second then break .
    like this .
    ffmpeg -t 20 test.avi <- when reach 20 second he put the break line . just need after finish call another program. Only that .

    Thanks for helping anyway .

    Carlos .

  7. #7
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Shadow i really understant what you fell about this dummy question . Ok .
    But i think that the meaning of every message board is help each other .
    If you know more or less great it's just concern to you =).
    The purpose of a message board is to help each other, yes.

    What i request here it's just a help , because i read the FAQ , try it and don't work .
    Then because i don't know nothing about C and really need this solution i think post a message here .
    If you know nothing about C, then why are you attempting to write a program in C?

    Anyone with good heart that want help a dummy C user i really will apreciate .
    I'd love to, I really would. I just have a hard time understanding your question. Perhaps I should "brush up" on my foreign languages.

    Anyway i just wonder what i need to do to in this code tha i put above the way to call another program .
    I using this into a Linux Redhat box , the program will call another one in the same directory .
    Here.
    Code:
    system("edit");
    // If I were in the \command sub-directory under under the
    // C:\Windows directory, on a Win OS system, this would
    // launch the dos program, EDIT.
    Like I said before, there are many ways to launch an external program. Seeing as I have my compiled program in the C:\Windows\Command folder, this would call an external program residing in the same directory.

    If you wish to know specifics about the Linux way, perhaps finding some indepth tutorials, or awaiting another's response would be a solution. System, is probably not the best to call an external program by the way.

    The part that i mark it's about when i put the "-t" command he make a count to the second then break .
    like this .
    ffmpeg -t 20 test.avi <- when reach 20 second he put the break line . just need after finish call another program. Only that .


    Thanks for helping anyway .
    So you've got it solved?
    The world is waiting. I must leave you now.

  8. #8
    Registered User
    Join Date
    Mar 2002
    Posts
    7

    No . =(

    I don't wanna write a C code =) , i trying with the source adapt one to use here =).

    Work if i do this , but i think that this is not the most beautifull solution .

    part of Code that i change :

    /* finish if recording time exhausted */
    if (recording_time > 0 && min_pts >= recording_time)
    system("./teste");

    /* finish if recording time exhausted again */
    if (recording_time > 0 && min_pts >= recording_time)
    break;

    I make twice .

    Then when i enter the option -t he stop and run the "./teste".

    Working under a Linux RedHat Box .

    I read in some place about the execl command that run one program than kill the first one .
    I think that this will resolv .

    What this "./teste" does ? i put right away .

    Code of ./teste (Shell Script) :

    #!/bin/sh
    ###############################################
    # Carlos Arnt 06/04/2002 #
    ################################################## ############
    ################################################## ############


    DATE=`/bin/date +%d-%m-%Y-%H`
    MSG=""

    sleep 5

    ./ffmpeg -y -an -i larga.mpeg -vcodec msmpeg4 -r 3 -b 10 -f asf -t 5 $DATE1.asf
    mv $DATE1.asf /usr/local/videosofday

    exit 0
    EOF

    Understant now .
    I just need my program to call this one , then when he start again (Read above) , he start with the (day+month+year+hour.asf) format when finish he move the file to right place.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Inline asm
    By brietje698 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2007, 01:54 PM
  3. Problem with OpenGL tutorial
    By 2Biaz in forum Windows Programming
    Replies: 18
    Last Post: 09-16-2004, 11:02 AM
  4. C system call and library call
    By Coconut in forum C Programming
    Replies: 6
    Last Post: 08-22-2002, 11:20 AM
  5. Assembly example
    By Lynux-Penguin in forum C Programming
    Replies: 6
    Last Post: 04-24-2002, 07:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21