Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFmpeg unable to stream

    18 octobre 2013, par LadislavM

    I have a simple http server for incoming MPEG stream and I'm trying to stream video from another machine on the same network. It works using ffmpeg like this

    ffmpeg -f video4linux2 -i /dev/video0 -f mpeg1video http://myaddress.com:port
    

    But from one specific computer ffmpeg refuses to stream and I can't find out why. All I can get is this output:

    ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 16 2012 09:30:22 with gcc 4.5.3
    
    configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib 
    --mandir=/usr/share/man --enable-shared --cc=i686-pc-linux-gnu-gcc 
    --disable-static --enable-gpl --enable-postproc --enable-avfilter 
    --disable-stripping --disable-debug --disable-doc --disable-network 
    --disable-vaapi --disable-ffplay --disable-vdpau --disable-indev=v4l 
    --disable-indev=oss --disable-indev=jack --disable-outdev=oss 
    --disable-altivec --disable-avx --cpu=atom --enable-hardcoded-tables
    
    libavutil    50. 43. 0 / 50. 43. 0
    libavcodec   52.123. 0 / 52.123. 0
    libavformat  52.111. 0 / 52.111. 0
    libavdevice  52.  5. 0 / 52.  5. 0
    libavfilter   1. 80. 0 /  1. 80. 0
    libswscale    0. 14. 1 /  0. 14. 1
    libpostproc  51.  2. 0 / 51.  2. 0
    
  • Unable to stream file onto localhost - ffmpeg

    18 octobre 2013, par trueblue

    I am new to ffmpeg/ffserver. I am trying to stream a local file named Trial onto a localhost using ffserver. I want to run the file in browser as http://localhost:8090/feed1.ffm I am executing the below command in Ubuntu(Trial is a Mpeg TS file) :

      ffmpeg -i Trial http://localhost:8090/feed1.ffm
    

    Upon execution of above command I am getting below error :

    FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
      libavutil     49.15. 0 / 49.15. 0
      libavcodec    52.20. 1 / 52.20. 1
      libavformat   52.31. 0 / 52.31. 0
      libavdevice   52. 1. 0 / 52. 1. 0
      libavfilter    0. 4. 0 /  0. 4. 0
      libswscale     0. 7. 1 /  0. 7. 1
      libpostproc   51. 2. 0 / 51. 2. 0
      built on Jan 24 2013 19:42:59, gcc: 4.4.3
    
    Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.94 (60000/1001)
    Input #0, mpegts, from 'Trial':
      Duration: 00:00:04.22, start: 0.177633, bitrate: 40368 kb/s
      Program 2 
        Stream #0.0[0x21]: Video: mpeg2video, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 45000 kb/s, 59.94 tbr, 90k tbn, 119.88 tbc
    Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
        Stream #0.0: Video: flv, yuv420p, 352x288, q=1-5, 100 kb/s, 1000k tbn, 15 tbc
        Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 32 kb/s
        Stream #0.2: Video: mpeg1video, yuv420p, 160x128, q=3-31, 64 kb/s, 1000k tbn, 3 tbc
        Stream #0.3: Audio: mp2, 22050 Hz, mono, s16, 64 kb/s
        Stream #0.4: Video: msmpeg4, yuv420p, 352x240, q=3-31, 256 kb/s, 1000k tbn, 15 tbc
    Could not find input stream matching output stream #0.1
    

    My ffserver.conf file goes like this:

    # Port on which the server is listening. You must select a different
    # port from your standard HTTP web server if it is running on the same
    # computer.
    Port 8090
    
    # Address on which the server is bound. Only useful if you have
    # several network interfaces.
    BindAddress 0.0.0.0
    
    # Number of simultaneous HTTP connections that can be handled. It has
    # to be defined *before* the MaxClients parameter, since it defines the
    # MaxClients maximum limit.
    MaxHTTPConnections 2000
    
    # Number of simultaneous requests that can be handled. Since FFServer
    # is very fast, it is more likely that you will want to leave this high
    # and use MaxBandwidth, below.
    MaxClients 1000
    
    # This the maximum amount of kbit/sec that you are prepared to
    # consume when streaming to clients.
    MaxBandwidth 1000
    
    # Access log file (uses standard Apache log file format)
    # '-' is the standard output.
    CustomLog -
    
    # Suppress that if you want to launch ffserver as a daemon.
    NoDaemon
    
    
    ##################################################################
    # Definition of the live feeds. Each live feed contains one video
    # and/or audio sequence coming from an ffmpeg encoder or another
    # ffserver. This sequence may be encoded simultaneously with several
    # codecs at several resolutions.
    
    
    
    # You must use 'ffmpeg' to send a live feed to ffserver. In this
    # example, you can type:
    #
    # ffmpeg http://localhost:8090/feed1.ffm
    
    # ffserver can also do time shifting. It means that it can stream any
    # previously recorded live stream. The request should contain:
    # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
    # a path where the feed is stored on disk. You also specify the
    # maximum size of the feed, where zero means unlimited. Default:
    # File=/tmp/feed_name.ffm FileMaxSize=5M
    File /tmp/feed1.ffm
    FileMaxSize 5M
    
    # You could specify
    # ReadOnlyFile /saved/specialvideo.ffm
    # This marks the file as readonly and it will not be deleted or updated.
    
    # Specify launch in order to start ffmpeg automatically.
    # First ffmpeg must be defined with an appropriate path if needed,
    # after that options can follow, but avoid adding the http:// field
    #Launch ffmpeg
    
    # Only allow connections from localhost to the feed.
    ACL allow 127.0.0.1
    
    
    
    
    
    
    Feed feed1.ffm
    Format swf
    VideoCodec flv
    VideoFrameRate 15
    VideoBufferSize 80000
    VideoBitRate 100
    VideoQMin 1
    VideoQMax 5
    VideoSize 352x288
    PreRoll 0
    Noaudio
    
    
    ##################################################################
    # Now you can define each stream which will be generated from the
    # original audio and video stream. Each format has a filename (here
    # 'test1.mpg'). FFServer will send this stream when answering a
    # request containing this filename.
    
    
    
    # coming from live feed 'feed1'
    Feed feed1.ffm
    
    # Format of the stream : you can choose among:
    # mpeg       : MPEG-1 multiplexed video and audio
    # mpegvideo  : only MPEG-1 video
    # mp2        : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
    # ogg        : Ogg format (Vorbis audio codec)
    # rm         : RealNetworks-compatible stream. Multiplexed audio and video.
    # ra         : RealNetworks-compatible stream. Audio only.
    # mpjpeg     : Multipart JPEG (works with Netscape without any plugin)
    # jpeg       : Generate a single JPEG image.
    # asf        : ASF compatible streaming (Windows Media Player format).
    # swf        : Macromedia Flash compatible stream
    # avi        : AVI format (MPEG-4 video, MPEG audio sound)
    Format mpeg
    
    # Bitrate for the audio stream. Codecs usually support only a few
    # different bitrates.
    AudioBitRate 32
    
    # Number of audio channels: 1 = mono, 2 = stereo
    AudioChannels 1
    
    # Sampling frequency for audio. When using low bitrates, you should
    # lower this frequency to 22050 or 11025. The supported frequencies
    # depend on the selected audio codec.
    AudioSampleRate 44100
    
    # Bitrate for the video stream
    VideoBitRate 64
    
    
    # Ratecontrol buffer size
    VideoBufferSize 40
    
    # Number of frames per second
    VideoFrameRate 3
    
    # Size of the video frame: WxH (default: 160x128)
    # The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
    # qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
    # wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
    # hd1080
    VideoSize 160x128
    
    # Transmit only intra frames (useful for low bitrates, but kills frame rate).
    #VideoIntraOnly
    
    # If non-intra only, an intra frame is transmitted every VideoGopSize
    # frames. Video synchronization can only begin at an intra frame.
    VideoGopSize 12
    
    # More MPEG-4 parameters
    # VideoHighQuality
    # Video4MotionVector
    
    # Choose your codecs:
    #AudioCodec mp2
    #VideoCodec mpeg1video
    
    # Suppress audio
    #NoAudio
    
    # Suppress video
    #NoVideo
    
    #VideoQMin 3
    #VideoQMax 31
    
    # Set this to the number of seconds backwards in time to start. Note that
    # most players will buffer 5-10 seconds of video, and also you need to allow
    # for a keyframe to appear in the data stream.
    #Preroll 15
    
    # ACL:
    
    # You can allow ranges of addresses (or single addresses)
    #ACL ALLOW  
    
    # You can deny ranges of addresses (or single addresses)
    #ACL DENY  
    
    # You can repeat the ACL allow/deny as often as you like. It is on a per
    # stream basis. The first match defines the action. If there are no matches,
    # then the default is the inverse of the last ACL statement.
    #
    # Thus 'ACL allow localhost' only allows access from localhost.
    # 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
    # allow everybody else.
    
    
    
    
    ##################################################################
    # Example streams
    
    
    # Multipart JPEG
    
    #
    #Feed feed1.ffm
    #Format mpjpeg
    #VideoFrameRate 2
    #VideoIntraOnly
    #NoAudio
    #Strict -1
    #
    
    
    # Single JPEG
    
    #
    #Feed feed1.ffm
    #Format jpeg
    #VideoFrameRate 2
    #VideoIntraOnly
    ##VideoSize 352x240
    #NoAudio
    #Strict -1
    #
    
    
    
    # Flash
    
    #
    #Feed feed1.ffm
    #Format swf
    #VideoFrameRate 2
    #VideoIntraOnly
    #NoAudio
    #
    
    
    # ASF compatible
    
    
    Feed feed1.ffm
    Format asf
    VideoFrameRate 15
    VideoSize 352x240
    VideoBitRate 256
    VideoBufferSize 40
    VideoGopSize 30
    AudioBitRate 64
    StartSendOnKey
    
    
    
    # MP3 audio
    
    #
    #Feed feed1.ffm
    #Format mp2
    #AudioCodec mp3
    #AudioBitRate 64
    #AudioChannels 1
    #AudioSampleRate 44100
    #NoVideo
    #
    
    
    # Ogg Vorbis audio
    
    #
    #Feed feed1.ffm
    #Title "Stream title"
    #AudioBitRate 64
    #AudioChannels 2
    #AudioSampleRate 44100
    #NoVideo
    #
    
    
    # Real with audio only at 32 kbits
    
    #
    #Feed feed1.ffm
    #Format rm
    #AudioBitRate 32
    #NoVideo
    #NoAudio
    #
    
    
    # Real with audio and video at 64 kbits
    
    #
    #Feed feed1.ffm
    #Format rm
    #AudioBitRate 32
    #VideoBitRate 128
    #VideoFrameRate 25
    #VideoGopSize 25
    #NoAudio
    #
    
    
    ##################################################################
    # A stream coming from a file: you only need to set the input
    # filename and optionally a new format. Supported conversions:
    #    AVI -> ASF
    
    #
    #File "/usr/local/httpd/htdocs/tlive.rm"
    #NoAudio
    #
    
    #
    #File "/usr/local/httpd/htdocs/test.asf"
    #NoAudio
    #Author "Me"
    #Copyright "Super MegaCorp"
    #Title "Test stream from disk"
    #Comment "Test comment"
    #
    
    
    ##################################################################
    # RTSP examples
    #
    # You can access this stream with the RTSP URL:
    #   rtsp://localhost:5454/test1-rtsp.mpg
    #
    # A non-standard RTSP redirector is also created. Its URL is:
    #   http://localhost:8090/test1-rtsp.rtsp
    
    #
    #Format rtp
    #File "/usr/local/httpd/htdocs/test1.mpg"
    #
    
    
    ##################################################################
    # SDP/multicast examples
    #
    # If you want to send your stream in multicast, you must set the
    # multicast address with MulticastAddress. The port and the TTL can
    # also be set.
    #
    # An SDP file is automatically generated by ffserver by adding the
    # 'sdp' extension to the stream name (here
    # http://localhost:8090/test1-sdp.sdp). You should usually give this
    # file to your player to play the stream.
    #
    # The 'NoLoop' option can be used to avoid looping when the stream is
    # terminated.
    
    #
    #Format rtp
    #File "/usr/local/httpd/htdocs/test1.mpg"
    #MulticastAddress 224.124.0.1
    #MulticastPort 5000
    #MulticastTTL 16
    #NoLoop
    #
    
    
    ##################################################################
    # Special streams
    
    # Server status
    
    
    Format status
    
    # Only allow local people to get the status
    ACL allow localhost
    ACL allow 192.168.0.0 192.168.255.255
    
    #FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
    
    
    
    # Redirect index.html to the appropriate site
    
    
    URL http://www.ffmpeg.org/
    
    

    Kindly anyone please assist me whether I am missing something or do i need to change my server.conf file? I have referred many websites. But still I am unable to fix it. Thanks in advance.

  • rtp server using ffmpeg in VC++ [on hold]

    18 octobre 2013, par NetCoder89

    I'm in the mid of my project.

    My task is to create an RTP server that can stream a file using ffmpeg in VC++. I got the ffmpeg.c but its complicate to understand for me. However I can:

    Open the file using ffmpeg and can read it or can read the frames those are to be transmitted using VC++

    But I'm not getting any way to stream it.

    Please share your Experience and suggestions.

    Thanks!

  • Multiple files in JW Player 6 not working

    18 octobre 2013, par Dvex

    Use version 6 JW Player. I'm transforming my videos using FFMPEG to MP4, FLV and WebM.

    When the videos are intended to be played, it does not and I have the following error:

    Error playing media: 
    MediaError
    code: 4
    __proto__: MediaError
    MEDIA_ERR_ABORTED: 1
    MEDIA_ERR_DECODE: 3
    MEDIA_ERR_ENCRYPTED: 5
    MEDIA_ERR_NETWORK: 2
    MEDIA_ERR_SRC_NOT_SUPPORTED: 4
    constructor: function MediaError() { [native code] }
    __proto__: Object
     jwplayer.js?muokxc:4
    CAPTIONS([object Object]) jwplayer.js?muokxc:4
    CAPTIONS([object Object]) 
    

    In Firefox I have the error: "The file can not be decoded". This scenario only happens on my server. But on localhost, does not happen. The videos can be played normally.

    What is it that is happening?

    My JS code to initialize the JW Player is:

    jwplayer('jwplayerjw-player').setup({
    "aspectratio":"16:9",
    "playlist":[{
    "image":"http://mydomain.com/system/files/videos/thumbnails/48/thumbnail-48_0002.png",
    "sources":[{
    "file":"http://mydomain.com/system/files/videos/converted/48/loop_2_flv_1381794678.flv"},
    {"file":"http://mydomain.com/system/files/videos/converted/48/loop_2_mp4_1381794691.mp4"},
    {"file":"http://mydomain.com/system/files/videos/converted/48/loop_2_webm_1381794705.webm"}]}],
    "width":"100%",
    "height":360,
    "stretching":"fill",
    "skin":"sites/all/libraries/jwplayer/skin.xml"
    });
    
  • ffmpeg avcodec_decode_video2 is crashing the andrid app

    18 octobre 2013, par Azhagiri

    HI i am using ffmpeg library in my android app. Using the library from https://github.com/churnlabs/android-ffmpeg-sample

    My application crashes when i am calling the avcodec_decode_video2() function. My code

        int decode_packet(int *got_frame, int cached){
        int ret = 0;
        int decoded = packet.size;
        if (packet.stream_index == videoStream) {
        /* decode video frame */
        ret = avcodec_decode_video2(pCodecCtx, pFrame, got_frame, &packet);
        if (ret < 0) {
        LOGE("Error decoding video frame");
        return ret;
        }
        if (*got_frame) {
             av_image_copy(video_dst_data, video_dst_linesize, (const uint8_t **)(pFrame->data), pFrame->linesize, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
            /* write to rawvideo file */
             LOGE("Frame Count [%d]",video_frame_count++);
        //  fwrite(video_dst_data[0], 1, video_dst_bufsize, videoOut);
        }
        return decoded;
        }
    }
    

    The app crashes at the line

    ret = avcodec_decode_video2(pCodecCtx, pFrame, got_frame, &packet);
    

    Help to get resolve the problem. I'll attach the ndk-stack output also

    ********** Crash dump: **********
    Build fingerprint: 'samsung/ja3gxx/ja3g:4.2.2/JDQ39/I9500XWUBMG5:user/release-keys'
    pid: 12494, tid: 12512, name: Thread-1088  >>> com.churnlabs.ffmpegsample <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000020
    Stack frame #00  pc 00285804  /data/app-lib/com.churnlabs.ffmpegsample-1/libffmpegutils.so (avcodec_decode_video2+60)
    Stack frame #01  pc 00285854  /data/app-lib/com.churnlabs.ffmpegsample-1/libffmpegutils.so (avcodec_decode_video2+140)
    Crash dump is completed
    

    From this i can find the function which crashes but i can't find the reason for the crash and how to get out from that