Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Android FFmpegMediaPlayer Error(0, 0) while playing it ?

    6 janvier 2017, par Jaydip Umaretiya

    I try to play Video with FFmpegMediaPlayer when I'm playing video I got Error(0,0) and for this I try FFmpegMediaPlayer for it. Here is my code.

    FFmpegMediaPlayer fFmpegMediaPlayer = new FFmpegMediaPlayer();
        try {
            fFmpegMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            fFmpegMediaPlayer.setDataSource(videoPath);
            fFmpegMediaPlayer.prepareAsync();
        } catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) {
            e.printStackTrace();
        }
    
    fFmpegMediaPlayer.setOnPreparedListener(new FFmpegMediaPlayer.OnPreparedListener() {
    
        @Override
        public void onPrepared(FFmpegMediaPlayer mp) {
            mp.start();
        }
    });
    
    fFmpegMediaPlayer.setOnErrorListener(new FFmpegMediaPlayer.OnErrorListener() {
    
        @Override
        public boolean onError(FFmpegMediaPlayer mp, int what, int extra) {
            mp.release();
            return false;
        }
    });
    

    Here is my Log

    I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
    V/FFmpegMediaPlayer-JNI: native_init
    V/FFmpegMediaPlayer-JNI: native_setup
    V/FFmpegMediaPlayer-JNI: setAudioStreamType: 3
    V/FFmpegMediaPlayer-JNI: setDataSource: path https://app.snapinfo.com/Areas/Museum/AppImages/SubCategory/290/11_14_16_13_21_39_Art%20Gallery%20Spheres-Mobile.mp4
    I/com.jagdeep.util.MyLifecycleHandler: still foreground
    E/EGL_emulation: tid 29418: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
    W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7d55d5fcaf80, error=EGL_BAD_MATCH
    V/FFmpegMediaPlayer-JNI: notify: 100
    E/FFmpegMediaPlayer: Error (0,0)
    V/FFmpegMediaPlayer-JNI: release
    
  • How to catch the ffmpeg connection error on python

    6 janvier 2017, par user824624

    I am working on the ffmpeg with python.This works when the remote server is working well, however when the remote server is down, I could see the message on the shell saying 'Connection to tcp://xxxxxxx failed: Connection refused, blabla'

    pro = sp.Popen(command, preexec_fn=os.setsid, shell=False, stderr=sp.PIPE, stdout=sp.PIPE)
    

    catch exception approach 1:

    try:
       out = self.pro.stderr.readline()
       while out:
                print '......'
    except BrokenPipeError:
         print 'err'
    

    catch exception approach 2:

    for line in self.pro.stderr:
        try:
            print line
        except BrokenPipeError:
            print 'error'
    

    However none of these works.

  • Android : How to Join videos(Some files having audio and some files doesn't have audio) using ffmpeg [on hold]

    6 janvier 2017, par User

    fileList.txt
    // without audio
    file 'video1.mp4'
    // with audio
    file 'video2.mp4'
    // with audio
    file 'video3.mp4'

    =============

    final String[] concateCommand = new String[]{ "-f", "concat", "-safe", "0", "-i", fileList.txt, "-c", "copy", "-y", outputFile.mp4};

    Description

    I have 3 video files(1 file having audio and other 2 not) When i join videos with above command the new video file is created but without audio. i.e. outputfile.mp4 is created according to first input file.

    I want output file in such a way that if a input file has audio then output file should have audio, if it doesn't have audio then in output file audio should not be there, corresponding to their duration of input files.

    Example

    Video1.mp4 : 1 mint without audio
    Video2.mp4 : 1 mint with audio
    Video3.mp4 : 1 mint with audio

    The output file should be in such a way i.e. first minute of video having audio and other 2 mints of video does not have audio when we join above three videos.

    Please help!!

  • how to reduce bitrate in hevc_vaapi and maintain good video quality in ffmpeg live streaming

    6 janvier 2017, par cold1746

    i tried the following code but i didint workout

    $ ffmpeg -vaapi_device /dev/dri/renderD128  -i input -vf 
    'format=nv12,hwupload,scale_vaapi=720:576' -preset slow -c:v hevc_vaapi -b:v 600k -maxrate 600k -bufsize 300k 
    -codec:a aac -b:a 96k -f mpegts -bf 0
    

    and vainfo is

    libva info: VA-API version 0.39.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.39 (libva 1.7.0) vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.0 vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264MultiviewHigh : VAEntrypointVLD VAProfileH264MultiviewHigh : VAEntrypointEncSlice VAProfileH264StereoHigh : VAEntrypointVLD VAProfileH264StereoHigh : VAEntrypointEncSlice VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc VAProfileJPEGBaseline : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointEncPicture VAProfileVP8Version0_3 : VAEntrypointVLD VAProfileVP8Version0_3 : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSlice

    and mediainfo is

    General Complete name : c.avi Format
    : AVI Format/Info : Audio Video Interleave Format profile : OpenDML File size : 1.17 GiB Duration
    : 1mn 0s Overall bit rate : 168 Mbps Writing application : Lavf56.40.101

    Video ID : 0 Format
    : ProRes Format version : Version 0 Format profile : High Codec ID
    : apch Duration : 1mn 0s Bit rate
    : 166 Mbps Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate
    : 24.000 fps Color space : YUV Chroma subsampling : 4:2:2 Scan type
    : Progressive Bits/(Pixel*Frame) : 3.343 Stream size : 1.16 GiB (99%) Writing library
    : abm0 Matrix coefficients : BT.709

    Audio ID : 1 Format
    : PCM Format settings, Endianness : Little Format settings, Sign : Signed Codec ID
    : 1 Duration : 1mn 0s Bit rate mode
    : Constant Bit rate : 1 536 Kbps Channel(s) : 2 channels Sampling rate
    : 48.0 KHz Bit depth : 16 bits Stream size : 11.0 MiB (1%) Alignment
    : Aligned on interleaves Interleave, duration : 21 ms (0.50 video frame)

    im getting less file size and good quality for hevc encoding

  • How to stitch videos to one 360 video without 3rd party software ?

    6 janvier 2017, par Basset hound

    I am using a 3D software, something like GTA.
    I wanted to create a 360 video.
    What I did was create 84 videos automatically by C#.

    Set camera orientation to, (Step = 30 degree)

    1. (Rx, Ry, Rz) = (0.0, -90.0, 0.0)
    2. (Rx, Ry, Rz) = (0.0, -90.0, 30.0)
    3. (Rx, Ry, Rz) = (0.0, -90.0, 60.0)
    ...
    12. (Rx, Ry, Rz) = (0.0, -90.0, 330.0) 
    
    13. (Rx, Ry, Rz) = (0.0, -60.0, 0.0) 
    14. (Rx, Ry, Rz) = (0.0, -60.0, 30.0)
    15. (Rx, Ry, Rz) = (0.0, -60.0, 60.0) 
    ...
    83. (Rx, Ry, Rz) = (0.0, 90.0, 300.0) 
    84. (Rx, Ry, Rz) = (0.0, 90.0, 330.0) 
    

    After created 84 videos, I used Kolor Autopano Video to stitch the video.
    The result is good.

    However, I was wondering, each video has precise camera orientation.
    I think I don't really need Kolor Autopano Video to create 360 video.
    Is it possible to stitch 84 videos by FFmpeg or C#?
    Do you have any hint about this?

    Thank you.