Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to get Updated Shared Object Files of OpenCV and FFMPEG libraries to overcome Libpng vulnerability ? [duplicate]

    3 mars 2017, par Liya

    This question already has an answer here:

    We seek a technical help on a current issue which we are facing with one of our android application.

    Our application is for live video streaming and recording (both audio and video) using wifi camera . We have completed the development process and every functionality of the application is working as expected in current version. but once we tried to upload the application to Google has rejected the application stating that vulnerability issue with Libpng library version.

    Our application uses OpenCV, FFMPEG, JavaCV and JavaCPP libraries for Image processing for Video generation. But when we tried to upload to play store google have rejected application with following message:

    “ Hello Google Play Developer,

    We rejected Application name, for violating our Malicious Behavior or User Data policy. If you submitted an update, the previous version of your app is still available on Google Play.

    This app uses software that contains security vulnerabilities for users or allows the collection of user data without proper disclosure.

    Below is the list of issues and the corresponding APK versions that were detected in your recent submission. Please upgrade your app(s) as soon as possible and increment the version number of the upgraded APK.

    Vulnerability APK Version(s) Libpng library

    The vulnerabilities were fixed in libpng v1.0.66, v.1.2.56, v.1.4.19, v1.5.26 or higher. You can find more information about how resolve the issue in this Google Help Center article.”

    Since we have not used libpng library directly in our application we assume the problem is with opencv lib version which may be using libpng , so we replaced the opencv jar file with its gradle dependency and .so files of different libraries are combined in an armeabi.jar file and once we deleted the .so files from libs/armeabi.jar folder and uploaded to play store, then Google didn't rejected with vulnerability issue and it got uploaded to the play store but the recording isn't working in that version because we have removed the .SO files from the Project.

    So as per our assumptions the libpng vulnerability is not only due to opencv but also due to the other libraries or the .so files .So please kindly suggest us which all .SO files we can remove from the library , so our application functionality for video recording works properly .

    We tried to update the OpenCV, FFMPEG libraries and since the SO files are not getting regenerated so could not resolve this issue yet

    We already refer following links to find a solution :

    1. libpng-vulnerability

    2. opencv-in-android

    3. FFmpegAndroid

    For more information please read our stackover flow post regarding this issue:Libpng vulnerability

    We need help to solve this issue. Please let us know if you can help us to solve this issue since we are running out of time.

    PS : These are the assumptions we made on this issue, May be we are wrong , so please guide us to the right path so we can achieve our goal.

  • Concatenate mp4 video files on iOS using Libavformat

    3 mars 2017, par Felix

    I need to merge (i.e. concatenate) multiple video files (using H.264 codec) in an iOS application. The problem is I can't use AVFoundation because it can't handle the video format on iOS (no problem on MacOS). So I tried to use the FFmpeg library, specifically Libavformat for this task. I found C code that looks useful here: http://stackoverflow.com/a/16293046. But i can't get it to work and don't understand it completly. The output video file appears to play only black frames. I'm using the precompiled libraries from the FFmpeg CocoaPod.

    I was able to convert a single test video (which has 1GB) using the command line tool on my Mac:

    $ ffmpeg -i input.mp4 -vcodec copy output.mp4
    ffmpeg version 3.2.4-tessus Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
      libavutil      55. 34.101 / 55. 34.101
      libavcodec     57. 64.101 / 57. 64.101
      libavformat    57. 56.101 / 57. 56.101
      libavdevice    57.  1.100 / 57.  1.100
      libavfilter     6. 65.100 /  6. 65.100
      libswscale      4.  2.100 /  4.  2.100
      libswresample   2.  3.100 /  2.  3.100
      libpostproc    54.  1.100 / 54.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: mp42mp41isomiso2
        creation_time   : 2016-09-14T14:35:53.000000Z
      Duration: 00:04:32.29, start: 0.000000, bitrate: 30013 kb/s
        Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29958 kb/s, 50 fps, 50 tbr, 5k tbn, 100 tbc (default)
        Metadata:
          creation_time   : 2016-09-14T14:35:53.000000Z
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          creation_time   : 2016-09-14T14:35:53.000000Z
          handler_name    : SoundHandler
    Output #0, mp4, to 'output.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: mp42mp41isomiso2
        encoder         : Lavf57.56.101
        Stream #0:0(eng): Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29958 kb/s, 50 fps, 50 tbr, 10k tbn, 5k tbc (default)
        Metadata:
          creation_time   : 2016-09-14T14:35:53.000000Z
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          creation_time   : 2016-09-14T14:35:53.000000Z
          handler_name    : SoundHandler
          encoder         : Lavc57.64.101 aac
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=13577 fps=1280 q=-1.0 Lsize=  997604kB time=00:04:32.28 bitrate=30013.7kbits/s speed=25.7x    
    video:993034kB audio:4268kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030246%
    [aac @ 0x7fa849809e00] Qavg: 942.999
    

    This process is very fast (10 seconds) and I can play the resulting video on iOS using AVFoundation frameworks. If i could do the same for each input video using Libavformat in my iOS app i could solve my problem by merging the videos in a second step using AVAssetExportSession.

    Any help is appreciated.

  • Detect orientation of a recorded video in android

    3 mars 2017, par ultimate

    I want to make my custom media player and requires orientation info of video (for detecting it is recorded from front or back camera). for jpeg images i can use ExifInterface.TAG_ORIENTATION but for video how i can find this information.

    I tried to grab frame from video file and convert it into jpeg but again it always provides orientation 0 in all cases.

    Please help me. Thanks in advance.

  • Jw player is not playing mp3 having mime type "audio/x-mpeg"

    3 mars 2017, par john

    I am playing mp3 files on the JW player but i am facing a strange problem. JW player is playing mp3 files having mime type "audio/mpeg" but it is failed to play mp3 files having mime type "audio/x-mpeg". It is such a strange problem for me because both files are mp3 JW player should play both.

    I have also tried to convert mp3 file to mp3 file using ffmpeg in php but it is still producing mp3 file having mime type "audio/x-mpeg". exec(ffmpeg -i $input_file -vn -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3)

    one thing i need to mention that this file type is generating from ios app. I am stuck from 2 days in this issue. Your help would be really appreciated . Thanks

  • How do I independently fade in/out multiple (3+) overlay images over video using FFMPEG ?

    3 mars 2017, par blahblahber

    Using an arbitrary source video, I would like to INDEPENDENTLY fade in/fade out a minimum of three .png overlays/watermarks at various times throughout the video. I'm having trouble getting the syntax right for the filter chain.

    In these failed attempts below, I'm using four transparent .png images all at 1920x1080 using the same sized source input video. No scaling/positioning needed, just the overlays fading in and out at the defined times.

    I have the functionality working without fade, unsing 'enable', like so:

    ffmpeg -i vid1.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex 
    "overlay=0:0:enable='between(t,8,11)' [tmp];
    [tmp]overlay=0:0:enable='between(t,10,15)'[tmp1];
    [tmp1]overlay=0:0:enable='between(t,15,138)'[tmp2];
    [tmp2]overlay=0:0:enable='between(t,140,150)" 
    -c:v libx264 -c:a copy 
    -flags +global_header -shortest -s 1920x1080 -y out.mp4
    

    I just want the same control, using fade in/out.

    The following almost works as I'd like but I obviously don't want the entire output stream to fade out. I realize that adding the fade=out to lines 7, 8 & 9 is fading the combined output (starting at line 7), but this is as close as I've come where I see each overlay image actually fading. The defined fades in lines 3, 4 and 5 apparently don't affect anything, and that's where I defined them originally. When I copied them to the output stream, the fade works on each overlay image, but again I don't want it to affect the entire output stream, just the individual overlays.

    ffmpeg -i vid1.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex 
        "[1:v]fade=out:st=3:d=1[watermark0]; 
        [2:v]fade=out:st=4:d=1[watermark1]; 
        [3:v]fade=out:st=5:d=1[watermark2]; 
        [4:v]fade=out:st=6:d=1[watermark3]; 
        [0:v][watermark0] overlay=0:0 [tmp0]; 
        [tmp0][watermark1] overlay=0:0,fade=out:st=4:d=1 [tmp1]; 
        [tmp1][watermark2] overlay=0:0,fade=out:st=6:d=1 [tmp2]; 
        [tmp2][watermark3] overlay=0:0,fade=out:st=8:d=1 [out]" -map "[out]" -c:v libx264 -c:a copy 
        -flags +global_header -shortest -s 1920x1080 -y out.mp4
    

    I've also tried 'split' with similar results to the above, but the fade only seems to work on the first image (this one uses fade in as well):

    ffmpeg -i vid.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex 
    "[1:v]split=4[wm1][wm2][wm3][wm4]; 
    [wm1]fade=in:st=1:d=1:alpha=1,fade=out:st=3:d=1:alpha=1[ovr1]; 
    [wm2]fade=in:st=2:d=1:alpha=1,fade=out:st=4:d=1:alpha=1[ovr2]; 
    [wm3]fade=in:st=3:d=1:alpha=1,fade=out:st=5:d=1:alpha=1[ovr3]; 
    [wm4]fade=in:st=4:d=1:alpha=1,fade=out:st=6:d=1:alpha=1[ovr4]; 
    [0:v][ovr1]overlay=0:0[base1]; 
    [base1][ovr2]overlay=0:0[base2]; 
    [base2][ovr3]overlay=0:0[base3]; 
    [base3][ovr4]overlay=0:0[out]" -map "[out]" 
    -t 10 -c:v libx264 -c:a copy -flags +global_header -shortest -s 1920x1080 -y out.mp4
    

    Any help is greatly appreciated! :)