Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How does the ProcessBuilder constructor parameter work ?

    19 septembre 2014, par Houseman

    I'm doing this:

    String[] command = {ffmpegLoc+"ffmpeg.exe",
                "-i ",
                "\""+dir+params.getString(4)+".flv"+"\"",
                "-copyts",
                "-crf 18",
                "-profile:v baseline",
                "-level 3.0",
                "-pix_fmt yuv420p",
                "-preset veryslow",
                "\""+dir+params.getString(4)+".mp4"+"\""};
        try {
            getLogger().info("ffmpeg command " + command);
            ProcessBuilder builder = new ProcessBuilder(command);
            builder.redirectErrorStream(true);
            getLogger().info("Starting process");
            Process process = builder.start();
            InputStream stream =  process.getInputStream();
            BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line = null;
            while((line = in.readLine()) != null) {
              System.out.println(line);
            }
            process.waitFor();
    

    And I get this error from ffmpeg, which initializes correctly:

    Unrecognized option 'i '.
    Error splitting the argument list: Option not found
    

    So I thought "Maybe I don't need to split out each argument into an array"

    So I replaced the command with this:

    String[] command = {ffmpegLoc+"ffmpeg.exe",
                    "-i " + "\""+dir+params.getString(4)+".flv"+"\"" + " -copyts -crf 18 -profile:v baseline -level 3.0 -pix_fmt yuv420p -preset veryslow "+"\""+dir+params.getString(4)+".mp4"+"\""};
    

    And now I get this:

    Unrecognized option 'i C:/Program'.
    Error splitting the argument list: Option not found
    

    What happened to that hyphen before i?

    What happened to those double quotes wrapping the path to the .flv file?

    What is going on here?

    Edit:

    I dropped the escaped double-quotes, as per this answer, and now I get this:

    Unrecognized option 'i C:/Program Files (x86)/Wowza Media Systems/Wowza Streaming Engine 4.1.0/content/recorder/vid_test001.flv -copyts -crf 18 -profile:v baseline -level 3.0 -pix_fmt yuv420p -preset veryslow C:/Program Files (x86)/Wowza Media Systems/Wowza Streaming Engine 4.1.0/content/recorder/vid_test001.mp4'.
    Error splitting the argument list: Option not found
    

    And again that hyphen in front of the i is missing.

    Edit 2:

    Let's combine them: No escaped double-quotes combined with arguments each on their own index:

    String[] command = {ffmpegLoc+"ffmpeg.exe",
                "-i",
                dir+params.getString(4)+".flv",
                "-copyts", 
                "-crf 18",
                "-profile:v baseline",
                "-level 3.0",
                "-pix_fmt yuv420p",
                "-preset veryslow",
                dir+params.getString(4)+".mp4"};
    

    ffmpeg now gives me:

    Unrecognized option 'crf 18'.
    

    So we got to where we encountered our first whitespace, then failed.

  • how to make live streaming for multiple clients

    19 septembre 2014, par Abdulrahman Alcharbaji

    I have new project to do and I need some help to know where to start. I have more than 1000 DVR each with 4 channels, I need to be able to do live streaming for multiple clients, and clients could be android,iPhone or windows. Now throw searching i tried to check ffserver and ffmpeg but i couldn't find much references to guide me throw a solution for my problem. NOTE: the DVRs streaming with h.264 encoding.

    So Please can anybody help me by guiding me for a start or some good references about this particular issue.

    Many Thnaks

  • Forced audio stream in mp4 container

    19 septembre 2014, par artem

    How can I set one of the audio streams (first) in mp4 container as "forced"? I didn't find this option in ffmpeg. May be there are some other tools to do it?

    Here is an example for mkv container:

    ffmpeg -i test_orig.mkv 2>&1 | grep Stream
    Stream #0:0: Video: h264 (High), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1(ger): Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s (default) (forced)
    Stream #0:2(ger): Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s (forced)
    Stream #0:3(ger): Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s
    Stream #0:4(ger): Subtitle: dvd_subtitle (default)
    Stream #0:5(ger): Subtitle: dvd_subtitle (forced)
    Stream #0:6(ger): Subtitle: dvd_subtitle
    

    As you can see stream #0.1 is flagged as forced and default. I need to do the same for audio stream in mp4 container. I found a way to flag first audio stream as default in mp4 with ffmpeg, but I can't flag it as "forced".

  • How to use Ffmpeg in android studio ?

    19 septembre 2014, par Jitender Chaudhary

    I want to compress video and found only one solution to use ffmpeg.

    I found this Trying to use FFMPEG for android. Compiling but still not working but not able to get how he compiled it.

  • Save two video streams in one video file c#, Windows 8 application [on hold]

    19 septembre 2014, par manos

    I am developing a Windows store application which will be able to record video from two video sources (e.g. two usb cameras or usb camera and embeded tablet camera) and then save the two video streams in one video file. So, when the saved video will play, it will show a large video frame (video from camera 1) and inside that, in the top right corner, a smaller video frame (video from camera 2). Basically, i want to render one video on top of the other. I think the process is called picture in picture, but I am not 100% sure. I am able two capture the 2 video streams (same length, same video quality) but I do not know how to proceed after that. How to do the rendering. Do I save the streams into two files and then process those files or do i need to process the streams directly (merge them) and then save to file? I have read that you can do something like that by using ffmpeg libraries. But so far I have not managed to find any c# code to it. Any ideas?

    Thanks in advance, Manos