Newest 'ffmpeg' Questions - Stack Overflow

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

Articles published on the website

  • android ndk-build ffmpeg libffmpeg.so: unsupported ELF file type 2

    11 September 2014, by rosen

    when ndk-build ffmpeg, i got the error:

    /home/rosen/develop/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libffmpeg.so: unsupported ELF file type 2 collect2: ld returned 1 exit status make: * [obj/local/armeabi/libmain.so] Error 1

    What can I do to fix this, and make it work?

    this is ndk build again using V=1

    [armeabi] SharedLibrary : libmain.so /home/rosen/develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libmain.so -shared --sysroot=/home/rosen/develop/android-ndk-r10/platforms/android-9/arch-arm ./obj/local/armeabi/objs/main/__/SDL/src/main/android/SDL_android_main.o ./obj/local/armeabi/objs/main/tutorial01.o -lgcc ./obj/local/armeabi/libffmpeg.so ./obj/local/armeabi/libSDL2.so -no-canonical-prefixes -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/home/rosen/develop/android-ndk-r10/platforms/android-9/arch-arm/usr/lib -lGLESv1_CM -lGLESv2 -llog -lc -lm -o ./obj/local/armeabi/libmain.so /home/rosen/develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libffmpeg.so: unsupported ELF file type 2 collect2: error: ld returned 1 exit status make: * [obj/local/armeabi/libmain.so] Error 1

  • Add .mts and .mov support to node-webkit

    11 September 2014, by J4G

    I'm trying to create a basic video editor using node-webkit. Obviously, the video format support in Chrome is a huge limiting factor. I know that adding ffmpegsumo.dll adds support for .mp3 and h264. As far as I can tell, there are two options for me. Either I convert every video clip, live, using an ffmpeg stream, OR, I modify ffmpegsumo.dll to add support for the other video file types.

    So far I have been unsuccessful in accomplishing either. Using fluent-ffmpeg I recieve an error

    An error occurred: ffmpeg exited with code 1

    whenever I try to use .writeToStream(). Can anyone advice me in how to proceed?

  • Video quality when desktop recording is bad

    11 September 2014, by bobbyrne01

    Trying to record my desktop and also audio with RHEL6.
    I'm using the command below, but the quality of the video output is not good.
    It is very blurry and I can bearly make out text on screen.
    The audio is good so no issues there.

    Does anyone know how the make the video quality any better?

    ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -sameq -f mpeg -ar 48000 -s wvga -y sample.avi
    
  • FFMPEG Cutting Commercials puts audio out of sync

    11 September 2014, by JaBbA

    Ubuntu 14.04.1 with the real ffmpeg loaded (same problem with the avconv version).

    I'm trying to take files created in MythTV with a HDPVR, cut the commercials and put the video into an MP4 container for use with MythRoku.

    the command

    ffmpeg -i $file -acodec copy -vcodec copy -f mp4 file.mp4

    Works fine. Once I update the database, I can watch the file in MythRoku or Plex.

    However, when I try to cut out the commercials, the audio gets out of sync by just over 1 second (audio delayed) whenever I cut past the 0 mark. Totem Video player and VLC both play the resulting video fine, but I can see a "hitch" at the beginning while they are syncing the audio, so I know the information on the audio sync is in the file somewhere. Mythroku and Plex both are out of sync when playing the file. The MythTV Frontend player actually does play it correctly, and I can hear the "hitch" as it syncs the audio.

    After hours of reading posts and playing with settings, I've got it down to this:

    If I say:

    ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 0 -t out.mp4

    The file is fine, plays both locally and in MythRoku/Plex

    But if I advance the start any amount - even 1 second - audio is out of sync

    ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 1 -t out.mp4

    I've tried splitting the video (as mp4) and audio (as ac3) first, splitting them separately, and then putting them back together as the last step, but I get the same results.

    The information is in the file - Totem, VLC and the Frontend all can figure it out. How can I get ffmpeg to figure out the sync and write the file so it's correct?

    Original file:

    mythtv@marvin:~$ mediainfo /var/lib/mythtv/recordings/2225_20140824001500.mpg
    General
    ID                                       : 0 (0x0)
    Complete name                            :     /var/lib/mythtv/recordings/2225_20140824001500.mpg
    Format                                   : MPEG-TS
    File size                                : 4.03 GiB
    Duration                                 : 1h 45mn
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 5 491 Kbps
    
    Video
    ID                                       : 4113 (0x1011)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : Main@L4.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Format settings, GOP                     : M=4, N=32
    Codec ID                                 : 27
    Duration                                 : 1h 45mn
    Bit rate mode                            : Variable
    Bit rate                                 : 4 831 Kbps
    Maximum bit rate                         : 20.0 Mbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 59.940 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.087
    Stream size                              : 3.55 GiB (88%)
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio
    ID                                       : 4352 (0x1100)
    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                                 : 1h 45mn
    Bit rate mode                            : Constant
    Bit rate                                 : 384 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Delay relative to video                  : -6ms
    Stream size                              : 289 MiB (7%)
    

    File cut from 0:

    mythtv@marvin:~$ mediainfo 2225_20140824001500_1.mp4
    General
    Complete name                            : 2225_20140824001500_1.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 58.5 MiB
    Duration                                 : 1mn 45s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 4 676 Kbps
    Writing application                      : Lavf54.63.104
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : Main@L4.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Format settings, GOP                     : M=4, N=32
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1mn 45s
    Bit rate mode                            : Variable
    Bit rate                                 : 4 281 Kbps
    Maximum bit rate                         : 20.0 Mbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Variable
    Frame rate                               : 59.940 fps
    Minimum frame rate                       : 59.920 fps
    Maximum frame rate                       : 59.960 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.077
    Stream size                              : 53.6 MiB (92%)
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio
    ID                                       : 2
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : ac-3
    Duration                                 : 1mn 45s
    Bit rate mode                            : Constant
    Bit rate                                 : 384 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 4.81 MiB (8%)
    

    File cut from 1 second with audio sync problem:

    mythtv@marvin:~$ mediainfo 2225_20140824001500_2.mp4
    General
    Complete name                            : 2225_20140824001500_2.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 68.0 MiB
    Duration                                 : 2mn 0s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 4 750 Kbps
    Writing application                      : Lavf54.63.104
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : Main@L4.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Format settings, GOP                     : M=4, N=32
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1mn 58s
    Bit rate mode                            : Variable
    Bit rate                                 : 4 394 Kbps
    Maximum bit rate                         : 20.0 Mbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Variable
    Frame rate                               : 59.940 fps
    Minimum frame rate                       : 59.920 fps
    Maximum frame rate                       : 59.960 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.080
    Stream size                              : 62.3 MiB (92%)
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio
    ID                                       : 2
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : ac-3
    Duration                                 : 2mn 0s
    Bit rate mode                            : Constant
    Bit rate                                 : 384 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 5.49 MiB (8%)
    
  • ffmpeg to convert .avi, .mp4, .mp3, .flv, .mkv to mp4

    10 September 2014, by Mikael Mezio

    I searching for a script that contains all of that attributes like the title.

    I have done one simple but that is only for one attribute so far and i do not want one script for each of all attributes to not be confused.

    Like this, running the script for like 10 minutes to see if there is any file that consist .flv and the automatic doing a convert for the file to a mp4 attribute.

    #!/bin/bash
    # Convert all flv to mp4
    ext=.mp4
    for file in *.flv; do
    currmov=$file$ext
    ffmpeg -r 15  -i $file  -b 296k -s 640x320 -vcodec mpeg4 -acodec aac $currmov
    done
    

    Thanks for help! /M