Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG build still resulting in Illegal instruction on raspberry pi ZERO, but not PI 2+

    3 mai 2017, par zyeek

    The process in which I do it configures the lib and ffmpeg files on the zero then move over to a pi 3 to make and install it (for speed).

    Build process:

    # x264
    git clone git://git.videolan.org/x264.git
    cd x264
    sudo ./configure --host=arm-unknown-linux-gnueabi --enable-shared --disable-opencl
    sudo make
    sudo make install
    sudo ldconfig
    
    # FFMPEG
    git clone git://source.ffmpeg.org/ffmpeg.git
    cd ffmpeg
    sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
    sudo make
    sudo make install
    

    I tried following this cross compile type build but complained I was missing a C compiler, but GCC was installed. SO I just went to follow my previous method.

    Results of trying to run it:

    pi@raspberrypi:~ $ ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -preset ultrafast -crf 0 http://localhost:8090/feed1.ffm
    ffmpeg version N-85747-gc4be288 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 4.9.2 (Raspbian 4.9.2-10)
      configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
      libavutil      55. 61.100 / 55. 61.100
      libavcodec     57. 93.100 / 57. 93.100
      libavformat    57. 72.101 / 57. 72.101
      libavdevice    57.  7.100 / 57.  7.100
      libavfilter     6. 88.100 /  6. 88.100
      libswscale      4.  7.101 /  4.  7.101
      libswresample   2.  8.100 /  2.  8.100
      libpostproc    54.  6.100 / 54.  6.100
    Input #0, video4linux2,v4l2, from '/dev/video0':
      Duration: N/A, start: 682.500534, bitrate: 110592 kb/s
        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    [tcp @ 0x2cba570] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
    Wed May  3 12:30:16 2017 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
    [tcp @ 0x2cbf1b0] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    No pixel format specified, yuv422p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    Wed May  3 12:30:16 2017 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 0
    Illegal instruction
    
  • Using ffmpeg -sseof with pipe

    3 mai 2017, par Thrasd

    I am working on extracting and transcoding a clip from a 4K video. I already know where to start and how long the clip should last.

    I am using the following command to extract the clip I need (30 sec into the video, I take a 10 sec clip)
    ffmpeg -ss 30 -i 'input.mp4' -c copy -t 10 -f matroska 'output.mp4'

    In order for the video to retain the key frame, so it knows what to draw, the clip can be longer than 10 sec (which is to be expected)

    I can then use the following to transcode the video, and make sure it only takes the last 10 seconds (Specifically the sseof command)
    ffmpeg -sseof -10 -i 'output.mp4' -vcodec libx264 -r 15 -s 720x400 -aspect 720:400 -sn -f matroska -acodec libmp3lame -ac 2 -ar 11025 -y 'transcoded.mkv'

    Due to a slow file system, I would like to avoid the first step of writing the extracted clip to the disk, I can do this with pipes and just transcode on the fly.
    ffmpeg -ss 30 -i 'input.mp4' -c copy -t 10 -f matroska pipe:1 | ffmpeg -i pipe:0 -vcodec libx264 -r 15 -s 720x400 -aspect 720:400 -sn -f matroska -acodec libmp3lame -ac 2 -ar 11025 -y 'transcoded.mkv'

    However with pipes I can not use the -sseof command, as it just makes an invalid video clip file. (There are no errors or warnings from the log)

    My current solution is to transcode the transcoded video clip again, and only take the last 10 seconds. (But this seems like a poor workaround, and not a real solution)

    As this is my first time working with ffmpeg, I am wondering if it is possible to take the last 10 seconds of a video through a pipe? Or maybe somebody has an even better solution for this?

  • Cut video with ffmpeg in Ubuntu

    3 mai 2017, par PHP Developer

    I execute the command in Ubuntu to cut a video:

    /usr/bin/ffmpeg -i video.mp4 -an -ss 00:00:1 -t 00:00:08 -async 1
    

    In Windows 10 its work, but not work in Ubuntu.

    I receive in Ubuntu the warning:

    Trailing options were found on the commandline.

    and receive the error:

    At least one output file must be specified

    What do I do?

  • How can I use ffmpeg to split the video into 10 minute chunks in android ?

    3 mai 2017, par Anil kumar

    Hi i am uploading big videos files to server but it's taking large time for uploading that's why i decided to send chunk files to server

    When i google it i found that FFMpeg is better for splitting videos files as some parts and i found below code but when i run below code i am getting exception like No such file or directory

    please help me some one i am facing this problem since two days but still no one given me right solution

    code:-

    public void getSplitCommand(String inputFileUrl, String outputFileUrl) {
    
            System.out.println("input file===>" + inputFileUrl);
            System.out.println("output file===>" + outputFileUrl);
    
    String cmd[] = new String[]{"-y ", "-i ", inputFileUrl , "00:00:02 ", "codec ","copy ","-t ","00:00:06 ",
                    outputFileUrl };
            }
    
    
        public void executeBinaryCommand(FFmpeg ffmpeg, String[] command) {
    
            try {
    
                if (ffmpeg != null) {
                    ffmpeg.execute(command,
                            new ExecuteBinaryResponseHandler() {
    
                                @Override
                                public void onFailure(String response) {
                                    System.out.println("failure====>" + response.toString());
                                }
    
                                @Override
                                public void onSuccess(String response) {
                                    System.out.println("resposense====>" + response.toString());
                                }
    
                                @Override
                                public void onProgress(String response) {
                                    System.out.println("on progress");
                                }
    
                                @Override
                                public void onStart() {
                                    System.out.println("start");
                                }
    
                                @Override
                                public void onFinish() {
                                    System.out.println("Finish");
                                }
                            });
                }
            } catch (FFmpegCommandAlreadyRunningException exception) {
                exception.printStackTrace();
            }
        }
    
  • Show Filename in Video (fmpeg - drawtext)

    3 mai 2017, par Niklas Wünsche

    right now, I want to add the filename of a video as text in the video itself. So if the video is in the file 'video2.mp4', there should be 'video2' written in the center of the video. How can I do this with drawtext?