Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Live WebRTC streams (getUserMedia) to DASH using WebM

    4 septembre 2015, par cyp

    I'm trying to understand the feasibility of a live streaming solution. I want to grab WebRTC streams (audio and video), send them to a server and transform them in chunks to send to a html5 video tag or a DASH player using WebM container (VP8 and Opus codecs).

    I also looked into ffmpeg, ffserver and gstreamer but...

    My question is how to feed the WebRTC streams (live) and transform them in HTTP chunks (live DASH compatible)?

    Anyone achieved something like this?

  • Using sauronsoftware's Jave in phonegap Android project

    4 septembre 2015, par Dread Boy

    I'm developing phonegap app and right now I'm trying to write a plugin to convert .amr files to .mp3 files. I'm using JAVE to do this conversion and while it's working on desktop it fails on android with this exception:

    java.io.IOException: Error running exec(). 
    Command: [/data/data//cache/jave-1/ffmpeg, -i, /sdcard/.amr, -vn, -acodec, libmp3lame, -f, mp3, -y, /sdcard/.mp3] 
    Working Directory: null Enviroment: null
    

    I'm trying to do conversion like this:

    private void convert(String input_file, CallbackContext callbackContext){
      File input = new File(input_file);
      File output = new File(input_file.replace(".amr", ".mp3"));
    
      Encoder encoder = new Encoder();
      EncodingAttributes encodingAttributes = new EncodingAttributes();
      AudioAttributes audioAttributes = new AudioAttributes();
      audioAttributes.setCodec("libmp3lame");
      encodingAttributes.setAudioAttributes(audioAttributes);
      encodingAttributes.setFormat("mp3");
    
      try{
        encoder.encode(input, output, encodingAttributes);
        input.delete();
        callbackContext.success("finished");
      }
      catch(Exception e){
         callbackContext.error(e.getMessage());
      }
    }
    

    I found this answer and I understand why error happens but the answer doesn't provide any solution. Is there a way to get this working in Phonegap project? Do I need to package ffmpeg library together with plugin and copy it to correct folder when app invokes the plugin?

    /data/data//cache/jave-1 
    
  • avconv : Saving MP4 is Taking Hours

    4 septembre 2015, par PeregrineStudios

    not entirely sure if I should post this on askubuntu or stackoverflow. Posted on askubuntu and not getting any answers. I'm hoping I can find an answer here.

    I'm setting up a website where users can upload videos and share them. I'm using avconv to reduce the video size and save it twice, once as an mp4 and again as a webm.

    Uploading a .MOV from a phone, the video conversion is quick and manageable.

    Uploading a .mp4 from a Samsung Galaxy S3, the video conversion to webm is also quick. But, the conversion to another mp4 takes FOREVER - literally hours. Why? Is anyone able to shed light on the problem?

    My avconv output is below.

    avconv -i /var/www/dev_jackpine/ottawa2017/temp_videos/37a949071acaee714dae829ca8df9b29.mp4 -c:v libx264 -vf transpose=1,transpose=1,transpose=1 -s 640x480 /var/www/dev_jackpine/ottawa2017/spinnies/test.mp4
    avconv version 0.8.17-4:0.8.17-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the Libav developers
    built on Mar 16 2015 13:26:50 with gcc 4.6.3
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/dev_jackpine/ottawa2017/temp_videos/37a949071acaee714dae829ca8df9b29.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 0
        compatible_brands: isom3gp4
        creation_time   : 2015-09-04 15:08:21
    Duration: 00:00:07.76, start: 0.000000, bitrate: 11756 kb/s
    Stream #0.0(eng): Video: h264 (Constrained Baseline), yuv420p, 1280x720, 11967 kb/s, 29.81 fps, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2015-09-04 15:08:21
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 119 kb/s
    Metadata:
      creation_time   : 2015-09-04 15:08:21
    File '/var/www/dev_jackpine/ottawa2017/spinnies/test.mp4' already exists. Overwrite ? [y/N] y
    [buffer @ 0xc3d580] w:1280 h:720 pixfmt:yuv420p
    [scale @ 0xc3dac0] w:1280 h:720 fmt:yuv420p -> w:640 h:480 fmt:yuv420p flags:0x4
    [transpose @ 0xc3e280] w:640 h:480 dir:1 -> w:480 h:640 rotation:clockwise vflip:0
    [transpose @ 0xc3e7c0] w:480 h:640 dir:1 -> w:640 h:480 rotation:clockwise vflip:0
    [transpose @ 0xc3ede0] w:640 h:480 dir:1 -> w:480 h:640 rotation:clockwise vflip:0
    [libx264 @ 0xc2b100] MB rate (108000000) > level limit (983040)
    [libx264 @ 0xc2b100] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
    [libx264 @ 0xc2b100] profile Main, level 5.1
    [libx264 @ 0xc2b100] 264 - core 120 r2151 a3f4407 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00
    Output #0, mp4, to '/var/www/dev_jackpine/ottawa2017/spinnies/test.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 0
        compatible_brands: isom3gp4
        creation_time   : 2015-09-04 15:08:21
        encoder         : Lavf53.21.1
        Stream #0.0(eng): Video: libx264, yuv420p, 480x640, q=-1--1, 180k tbn, 90k tbc
        Metadata:
          creation_time   : 2015-09-04 15:08:21
        Stream #0.1(eng): Audio: libvo_aacenc, 48000 Hz, stereo, s16, 200 kb/s
        Metadata:
          creation_time   : 2015-09-04 15:08:21
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> libx264)
      Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
    Press ctrl-c to stop encoding
    

    Here's an example frame output:

    frame=124398 fps=142 q=33.0 size=   16885kB time=1.38 bitrate=100110.2kbits/s dup=124356 drop=0
    

    I've had the process running the whole time I've been writing this question, and so far it's done... 22 frames.

    What could be the problem?

  • How to make SDL play FLTP samples (AAC) ?

    4 septembre 2015, par progdo

    The tutorials showed this way,

    SDL_AudioSpec   wanted_spec, spec;
    wanted_spec.freq = aCodecCtx->sample_rate;
    wanted_spec.format = AUDIO_S16SYS;
    wanted_spec.channels = aCodecCtx->channels;
    wanted_spec.silence = 0;
    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
    wanted_spec.callback = audio_callback;
    wanted_spec.userdata = aCodecCtx;
    SDL_OpenAudio(&wanted_spec, &spec);
    

    It doesn't work, apparently the samples are floating points and sdl audio spec format is 16 bit samples. How to make SDL work with floating point samples?

  • FFMPEG thumbnail in php application's is not rotated properly

    4 septembre 2015, par Vignesh

    I have created a FFMPEG thumbnail in a php application and tried to rotate the thumbnail image if the video is bottom up(reversed).But the image rotate is not working properly. The below is the code for image rotation

    $video = $storeHere.$mediaFile;
                                    $tImage = $upload_output['uploaded_file'].'.jpg';
                                    $thumbnail = $storeHere.$tImage;
                                    // shell command [highly simplified, please don't run it plain on your script!]
                                     shell_exec("ffmpeg -i $video -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg -s 250x250  $thumbnail 2>&1");
                                     /* image rotate fix */
                                        $source = imagecreatefromjpeg($thumbnail);
                                        $degrees = 270;
                                        $rotate = imagerotate($source, $degrees, 0);
                                        imagejpeg($rotate,$thumbnail);
                                     /* rotate fix ends */