Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to use ffmpeg to decode speex stream ?

    31 octobre 2013, par paradisal programmer

    I want to decode speex stream and extract audio from it.

    I've heard FFmpeg support speex codec, but i don't know how to use it.

    Is there any code sample about decoding speex stream data?

    Thanks in advance.

  • Can VideoView be detach and reattached without stopping the it ?

    31 octobre 2013, par Thierry-Dimitri Roy

    I'm building an app where the user clicks on a button to show a video full screen. Initially the video is attached to a view inside a ViewPager. To be able to show it fullscreen I detach it from its parent and reattach it to the root view. This works fine, except when the video is switched to fullscreen while playing. When I detach a playing VideoView it just stop and I need to restart it. This is not acceptable since the video starts buffering before resume. Here the part of the code where the detach is done:

        final ViewGroup parent = (ViewGroup) findViewById(R.id.parent);
    
        final ViewGroup root = (ViewGroup) findViewById(R.id.root);
    
        Button b = (Button) findViewById(R.id.button);
        b.setOnClickListener(new OnClickListener() {
    
            @Override
            public void onClick(View v) {
                parent.removeView(mVideoView);
    
                LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                root.addView(mVideoView, lp);
            }
        });
    

    Depending of the device, I have a different log error. Probably because the actual video player is provided by the manufacturer and not the Android SDK. Here are the error logs for a Nexus 7:

    10-30 20:26:18.618: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Begin 10-30 20:26:18.618: D/NvOsDebugPrintf(124): --------- Closing TVMR Frame Delivery Thread ------------- 10-30 20:26:18.678: D/NvOsDebugPrintf(124): ------- NvAvpClose ------- 10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Done 10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMLiteTVMRDecPrivateClose Done

    I haven't been able to detach the video without stopping it. I tried using SurfaceView or TextureView without success.

    I also tried finding a third party video player. I found a commercial one (http://www.vitamio.org/) that I can't really use for business reason. I found an open source one, that hasn't been updated in the last year (https://code.google.com/p/dolphin-player/).

    I'm currently targeting Android 4.2 or better on tablet only.

  • Debian ffmpeg working in terminal but not in php

    30 octobre 2013, par user2938660

    I reinstalled ffmpeg on debian and php exec doesn't work for me anymore when called from php. I'm using:

    if ($success_msg) 
    {
        $tmp_parts = explode('.', $file['name']);
        $ext = array_pop($tmp_parts);
        $ext = strtolower($ext);
        if($ext == "avi" && $convert_avi == true)
        {
            $convert_source = _VIDEOS_DIR_PATH.$new_name;
            $conv_name = substr(md5($file['name'].rand(1,888)), 2, 10).".mp4";
            //$conv_name2 = substr(md5($file['name'].rand(1,888)), 2, 10).".mp4";
            $converted_file  = _VIDEOS_DIR_PATH.$conv_name;
            //$fastarted_file  = _VIDEOS_DIR_PATH.$conv_name2;
            $ffmpeg_command = 'ffmpeg -i '.$convert_source.' -r 20 -g 40 -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -sameq '.$converted_file;
            //$faststart_command = "qt-faststart ".$converted_file." ".$fastarted_file;
            shell_exec($ffmpeg_command);
            unlink($convert_source);
            //shell_exec($faststart_command);
            $sql = "UPDATE pm_temp SET url = '".$conv_name."' WHERE url = '".$new_name."' LIMIT 1";
            $result = @mysql_query($sql);
    }
    echo $success_msg;
    

    this code to convert videos and ffmpeg output is:

    root@1tb:~# ffmpeg -version
    ffmpeg version git-2013-10-28-f1f0b01
    built on Oct 29 2013 02:05:45 with gcc 4.4.5 (Debian 4.4.5-8)
    configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
    libavutil      52. 48.100 / 52. 48.100
    libavcodec     55. 39.100 / 55. 39.100
    libavformat    55. 19.104 / 55. 19.104
    libavdevice    55.  5.100 / 55.  5.100
    libavfilter     3. 90.100 /  3. 90.100
    libswscale      2.  5.101 /  2.  5.101
    libswresample   0. 17.104 /  0. 17.104
    libpostproc    52.  3.100 / 52.  3.100
    root@1tb:~#
    

    in terminal it works fine just via php not im sure this is server problem and exec is enabled.

  • Put 2 FLV movies next to each other with FFmpeg

    30 octobre 2013, par Rubytastic

    Im new to ffmpeg and the documentations are overwhelming.

    Would like to "Glue" 2 FLV movies together (ascii art does not work here so)

    [ 1 ] [ 2 ]

    [1][2] <= create 1 new movie with the 2 video's playing next to each other

  • ffmepg suddently stopped working

    30 octobre 2013, par jdartland

    Hi Im using ffmpeg jwplayer to handle my video uploads. It worked just fine untill I added a video upload to a new model. My video files gets uploaded to the database but i can't play them in my jwplayer. I also noticed that ffmpeg converts files to avi eaven though I've specifyed it in both of my models to convert files into flv.

    Here is my javascrip "error":

    Error loading player:
    No playable sources found.
    

    My models, tabels and vews shuld work cus I haven't changed anything in my old working post module.

    Here is whats happening in the upload:

    Started PATCH "/posts/dsdsdsdsd" for 127.0.0.1 at 2013-10-30 15:37:53 +0100
    Processing by PostsController#update as HTML
      Parameters: {"utf8"=>"✓", "authenticity_token"=>"4Xp=", "post"=>{"title"=>"dsdsdsdsd", "content"=>"sdsdsdsdsd", "photo_delete"=>"0", "video_delete"=>"0", "video"=>#, @original_filename="Drossel_10bar__Pressure_inner_wall.avi", @content_type="video/x-msvideo", @headers="Content-Disposition: form-data; name=\"post[video]\"; filename=\"Drossel_10bar__Pressure_inner_wall.avi\"\r\nContent-Type: video/x-msvideo\r\n">}, "commit"=>"Update Post", "id"=>"dsdsdsdsd"}
      Admin Load (0.9ms)  SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 ORDER BY "admins"."id" ASC LIMIT 1
      Post Load (0.5ms)  SELECT "posts".* FROM "posts" WHERE "posts"."permalink" = 'dsdsdsdsd' ORDER BY created_at desc LIMIT 1
       (0.2ms)  BEGIN
    [paperclip] [ffmpeg] ffmpeg -i "/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt7.avi" 2>&1
    [paperclip] [ffmpeg] Command Success
    [paperclip] [ffmpeg] Making...
    [paperclip] [ffmpeg] Building Destination File: 'Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt7' + 'flv'
    [paperclip] [ffmpeg] Destination File Built
    [paperclip] [ffmpeg] Adding Geometry
    [paperclip] [ffmpeg] Extracting Target Dimensions
    [paperclip] [ffmpeg] Target Size is Available
    [paperclip] [ffmpeg] Keeping Aspect Ratio
    [paperclip] [ffmpeg] Resize
    [paperclip] [ffmpeg] Convert Options: 400x234
    [paperclip] [ffmpeg] Adding Format
    [paperclip] [ffmpeg] Adding Source
    [paperclip] [ffmpeg] Building Parameters
    [paperclip] [ffmpeg] -i :source -s 400x234 -y :dest
    Command :: ffmpeg -i '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt7.avi' -s 400x234 -y '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt720131030-6965-1fv54qn.flv'
    ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
      built on Apr  2 2013 17:02:36 with gcc 4.6.3
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    Input #0, avi, from '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt7.avi':
      Metadata:
        encoder         : Lavf52.64.2
      Duration: 00:00:00.00, start: 0.000000, bitrate: -2147483 kb/s
        Stream #0.0: Video: mjpeg, yuvj422p, 1588x936, 15 tbr, 15 tbn, 15 tbc
    Incompatible pixel format 'yuvj422p' for codec 'flv', auto-selecting format 'yuv420p'
    [buffer @ 0xdcd280] w:1588 h:936 pixfmt:yuvj422p
    [scale @ 0xdcd7c0] w:1588 h:936 fmt:yuvj422p -> w:400 h:234 fmt:yuv420p flags:0x4
    Output #0, flv, to '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt720131030-6965-1fv54qn.flv':
      Metadata:
        encoder         : Lavf53.21.1
        Stream #0.0: Video: flv, yuv420p, 400x234, q=2-31, 200 kb/s, 1k tbn, 15 tbc
    Stream mapping:
      Stream #0.0 -> #0.0
    Press ctrl-c to stop encoding
    frame=  451 fps=118 q=2.2 Lsize=     962kB time=30.07 bitrate= 262.1kbits/s    
    video:955kB audio:0kB global headers:0kB muxing overhead 0.759673%
    [paperclip] [qtfaststart] :source :dest
    Command :: qt-faststart '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt720131030-6965-1fv54qn.flv' '/tmp/Drossel_10bar__Pressure_inner_wall20131030-6965-14cqqt720131030-6965-1fv54qn20131030-6965-1a8cksd.flv'
      Post Exists (0.7ms)  SELECT 1 AS one FROM "posts" WHERE ("posts"."title" = 'dsdsdsdsd' AND "posts"."id" != 37) LIMIT 1
      SQL (0.7ms)  UPDATE "posts" SET "video_file_name" = $1, "video_content_type" = $2, "video_file_size" = $3, "video_updated_at" = $4, "updated_at" = $5 WHERE "posts"."id" = 37  [["video_file_name", "Drossel_10bar__Pressure_inner_wall.avi"], ["video_content_type", "video/x-msvideo"], ["video_file_size", 41766866], ["video_updated_at", Wed, 30 Oct 2013 14:37:53 UTC +00:00], ["updated_at", Wed, 30 Oct 2013 14:37:57 UTC +00:00]]
       (102.0ms)  COMMIT
    Redirected to http://0.0.0.0:3000/posts/dsdsdsdsd
    Completed 302 Found in 4078ms (ActiveRecord: 105.0ms)
    
    
    Started GET "/posts/dsdsdsdsd" for 127.0.0.1 at 2013-10-30 15:37:57 +0100
    Processing by PostsController#show as HTML
      Parameters: {"id"=>"dsdsdsdsd"}
      Post Load (0.5ms)  SELECT "posts".* FROM "posts" WHERE "posts"."permalink" = 'dsdsdsdsd' ORDER BY created_at desc LIMIT 1
      Admin Load (0.4ms)  SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 ORDER BY "admins"."id" ASC LIMIT 1
      Rendered posts/show.html.erb within layouts/application (4.3ms)
    Completed 200 OK in 17ms (Views: 14.3ms | ActiveRecord: 0.9ms)