Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to transcode avi or mov file to mpeg-ts with specific results ?

    15 juillet 2015, par Andy Do

    Can someone please help me convert a mov or mp4 file to mpeg-ts to look like the output below?

    So far I have this:

    ffmpeg -i test_5.mp4 -c copy -bsf h264_mp4toannexb -b:a test_5.ts

    and want to replicate this:

    Format                                   : MPEG-TS
    File size                                : 1.48 GiB
    Duration                                 : 11mn 45s
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 18.0 Mbps
    
    Video
    ID                                       : 481 (0x1E1)
    Menu ID                                  : 1 (0x1)
    Format                                   : MPEG Video
    Format version                           : Version 2
    Format profile                           : Main@Main
    Format settings, BVOP                    : Yes
    Format settings, Matrix                  : Custom
    Format settings, GOP                     : M=3, N=15
    Format settings, picture structure       : Frame
    Codec ID                                 : 2
    Duration                                 : 11mn 45s
    Bit rate                                 : 16.9 Mbps
    Maximum bit rate                         : 15.0 Mbps
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 29.970 fps
    Standard                                 : NTSC
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Scan order                               : Top Field First
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 1.633
    Time code of first frame                 : 00:00:00;00
    Time code source                         : Group of pictures header
    Stream size                              : 1.39 GiB (94%)
    
    Audio
    ID                                       : 482 (0x1E2)
    Menu ID                                  : 1 (0x1)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : 129
    Duration                                 : 11mn 45s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 16.2 MiB (1%)
    Language                                 : English
    

    Thanks if you can!

  • MP4 to OGG conversion does not include sound

    15 juillet 2015, par iamthestreets

    I found this question and I was able to successfully convert my video to OGG, but it does not include the sound.

    Here is the code:

    //SET FFMPEG PATH
    $ffmpegPath = 'ffmpeg';
    //CREATE CLASS INSTANCE
    $ffmpegObj = new ffmpeg_movie($video);
    //GET AUDIO BITRATE FROM SOURCE FILE
    $srcAB = intval($ffmpegObj->getAudioBitRate());
    //GET VIDEO BITRATE FROM SOURCE FILE
    $srcVB = intval($ffmpegObj->getVideoBitRate());                
    //SET THE AUDIO CODEC TO LIBVORBIS
    $aCodec = ' -acodec libvorbis';
    //SET THE VIDEO CODEC TO LIBTHEORA
    $vCodec = ' -vcodec libtheora';
    //EXECUTE THE CONVERSION
    exec($ffmpegPath." -i ".$video.$vCodec." -vb ".$srcVB." -ab ".$srcAB." ".$ogg_video); 
    

    What am I doing wrong?

  • change fps while-loops exporting ffmpeg

    15 juillet 2015, par wizards

    I am new to FFMPEG. I am trying to export still images from a video file. I did it correctly.

    Now i want to change average frame rate. That is if my video is 24fps and i want to export still images with 30fps. Now instead of 24 frames I need 30 frames.

    Cany you please help me what to do.

    Thanks in advance wizards

  • how does one loop a video using ffmpeg on android ?

    15 juillet 2015, par Magicomiralles

    I'm using hiteshsondhi88's "FFmpeg Android Java" library and it works fine for scaling, trans-coding, and overlaying. However, when I try to loop a video I just get the same un-looped video on my output.

    My code:

    String internalPath = getFilesDir().getPath(); //get internal directory
    String command = "-y -f concat -i "+internalPath+"/myList.txt -c copy "+internalPath+"/final.mp4";
    ffmpeg.execute(command, ffmpegResponseHandler);
    

    The text in "myList.txt" is generated programmatically but it looks like this:

    file 'final_unlooped.mp4' file 'final_unlooped.mp4' file 'final_unlooped.mp4' file 'final_unlooped.mp4' file 'final_unlooped.mp4'
    

    Finally, the log:

    ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
    built on Oct  7 2014 15:11:41 with gcc 4.8 (GCC)
    configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/i686-linux-android- --arch=x86 --cpu=i686 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/x86 --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -march=i686' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    libavutil      54.  7.100 / 54.  7.100
    libavcodec     56.  1.100 / 56.  1.100
    libavformat    56.  4.101 / 56.  4.101
    libavdevice    56.  0.100 / 56.  0.100
    libavfilter     5.  1.100 /  5.  1.100
    libswscale      3.  0.100 /  3.  0.100
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  0.100 / 53.  0.100
    Input #0, concat, from '/data/data/com.testApp/files/myList.txt':
    Duration: N/A, start: 0.000000, bitrate: 744 kb/s
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x640, 744 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Output #0, mp4, to '/data/data/com.testApp/files/final.mp4':
    Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x640, q=2-31, 744 kb/s, 25 fps, 12800 tbn, 12800 tbc
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    frame=  115 fps=0.0 q=-1.0 Lsize=     420kB time=00:00:04.48 bitrate= 768.1kbits/s
    video:418kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.509634%
    

    The OnSuccess() method in the response handler launches indicating that the execution was successful but the output is still unlooped.

    This command works fine on Windows but for some reason it wont work on Android. any ideas of what it could be, or what am I doing wrong?

  • PHP variable into FFMPEG

    14 juillet 2015, par kunal

    i am making web tool which should be able to search the file within the Archive and then get the duration of the video with FFMPEG Code.

    for search the file in the Archive , here is my code!

     $command ='find /mnt/archiev/ -name '.$_POST['MXF'].'.mxf';
    
        if (!($stream = ssh2_exec($con, $command))) {
                        echo "fail: unable to execute command\n";
                    } else {
                        $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
    
                        $FILE = stream_get_contents($stream); 
    
    / check if file exist or not and then run the Next command.
    
    if(!($FILE))
    {
            echo "file Doesnt Exist in the Archieve. please enter the correct file ID";
            ssh2_exec($con, "logout");
            exit;
    }
    elseif
    { 
    
    $commandA= ffmpeg -i '.$FILE.' 2>&1 | grep "Duration:"';
     (!($stream2 = ssh2_exec($con, $command))) {
                            echo "fail: unable to execute command\n";
                        } else {
                            $errorStream2 = ssh2_fetch_stream($stream2, SSH2_STREAM_STDERR);
    
                            $Duration = stream_get_contents($stream);
                            var_dump($duration);
    }
    }
    

    My problem is this code returns me NUll value , but it supposed to return me the Duration of video!

    Here $FILE has the file Path , where searched File exist but when i use this with ffmpeg code it returns null

    does anyone have idea how can i make it work, i need to be able to find the files within the archiev and then with stream_get_contens() funcation i get the path of the video and this path i need to use within the FFMPEG as a input but it doesnt work and return the NULL.

    which suppossed to retrun the video Duration.

    please help!!!

    thanks in adavance.