Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (85)

Sur d’autres sites (10097)

  • How to convert RTSP stream into flv/swf Stream (w. ffmpeg) ?

    22 octobre 2012, par acy

    I want embed a webcam stream (From geovision video server) into a website. Unfortunately only the rtsp stream gives direct access to the video data.

    I tried a bunch of different variants. With this version I got no errors :

    openRTSP -b 50000 -w 352 -h 288 -f 5 -v -c -u admin password rtsp://xxxxxx.dyndns.org:8554/CH001.sdp | \
    ffmpeg -r 5 -b 256000 -f mp4 -i - http://127.0.0.1:8090/feed1.ffm

    Unfortunately I get no video. Sometimes I see a single frame of the webcam, but no livestream.

    This is my ffserver.conf

    Port 8090
    BindAddress 0.0.0.0
    MaxClients 200
    MaxBandwidth 20000
    CustomLog /var/log/flvserver/access.log

    NoDaemon

    # Server Status
    <stream>
    Format status
    </stream>

    <feed>
    File /tmp/feed1.ffm
    FileMaxSize 200K
    ACL allow 127.0.0.1
    </feed>

    # SWF output - great for testing
    <stream>
    # the source feed
    Feed feed1.ffm
    # the output stream format - SWF = flash
    Format swf
    #VideoCodec flv
    # this must match the ffmpeg -r argument
    VideoFrameRate 5
    # another quality tweak
    VideoBitRate 256K
    # quality ranges - 1-31 (1 = best, 31 = worst)
    VideoQMin 1
    VideoQMax 3
    VideoSize 352x288
    # wecams don&#39;t have audio
    NoAudio
    </stream>

    What am I doing wrong ? THe test.swf seems to load forever...

  • Use ffmpeg to add text subtitles

    25 novembre 2016, par 0-alpha

    I am trying to add text subtitles to an .mp4 container using ffmpeg :

    ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mp4

    When I am trying to run this line, it gives me an error :

    Nmber of stream maps must match number of output streams.

    If I try to change the mp4 to mkv (although mp4 supports text subtitles), like this :

    ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mkv

    It correctly maps the streams, but gives an error :

    Encoder (codec id 94210) not found for output stream #0.2

    When I launch

    ffmpeg -codecs

    I can see that srt codec is supported as decoder and encoder, however I am not sure what is used for mp4 and mkv subs encoding, and whether I need to switch it on or compile separately.

  • How can I convince ffserver to save a locally-sourced webcam stream to a file in high resolution AND stream it in lower resolution ?

    2 novembre 2015, par Dominic Jacobssen

    We have a remote Linux machine, accessible over VPN, which has a USB webcam. We want to use this for video conferencing, but we also want to store the stream for archiving.

    Since the streaming bandwidth is limited, it makes sense to capture the stream on the same machine as the webcam and rsync that across after-the-fact, rather than trying to capture the streamed content, which is necessarily going to be poor quality.

    We’re trying to use ffmpeg and ffserver to achieve this, but with little success. Most of the articles on the internet either deal with just streaming a webcam, or rebroadcasting a remote stream. We found we had to recompile ffserver because of a missing "my_addr->sin_family = AF_INET ;" in the version of ffserver.c we had been using, since fixed in git.

    Here’s the ffserver.conf we’re trying to use :

    Port 43688
    BindAddress 127.0.0.1
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 1000
    CustomLog -
    NoDaemon
    <feed>
    ReadOnlyFile /tmp/feed.ffm
    FileMaxSize 20M
    ACL allow 127.0.0.1
    </feed>
    <stream>
    Feed feed.ffm
    Format mp4
    VideoSize qvga
    VideoGopSize 12
    VideoHighQuality
    Video4MotionVector
    VideoCodec libx264
    VideoBitRate 100
    VideoBufferSize 40
    VideoFrameRate 5
    VideoQMin 3
    VideoQMax 31
    AudioCodec libfaac
    AudioBitRate 32
    AudioChannels 2
    AudioSampleRate 22050
    ACL allow localhost
    </stream>

    When we fire this up, we get the error :

    Unable to create feed file '/tmp/feed.ffm' as it is marked readonly

    Fair enough, but this is not what is implied in the docs. Changing the directive to :

    File /tmp/feed.ffm

    allows ffserver to fire up and appear to sit and wait for ffmpeg to connect to it. However, when we fire up ffmpeg with the command :

    ffmpeg -f alsa -i pulse -r 16000 -f video4linux2 -s qvga -i /dev/video0 -r 5 -f mp4 -vcodec libx264 -sameq -acodec libfaac -ab 32k http://127.0.0.1:43688/feed.ffm

    then the webcam lights up and ffserver acknowledges the connection with the messages :

    New connection: POST /feed.ffm
    [POST] "/feed.ffm HTTP/1.1" 200 0

    but after a few seconds we get the errors :

    [mp4 @ 0x264b160] muxer does not support non seekable output
    Could not write header for output file #0 (incorrect codec parameters ?)

    We’ve tried various other formats (mpeg, mpegts, avi) and codecs (mpeg1video, mpeg2video, mpeg4), all without success.

    Moreover, we were under the impression that ffserver could reencode input format to a lower resolution for streaming, but if the stream resolution doesn’t match the feed resolution, we get an error about the resolutions not matching.

    Has anyone ever managed to get this working correctly ? I’ve read about vlc being able to do something like this, but the vlc command lines are well nigh impenetrable.

    Thanks !

    Dominic