• SEARCH
  • DOWNLOADS
  • MY ACCOUNT
  • Buy (0)
  • CONTACT
  • Free Trial
Wowza Logo
  • PRODUCTS
  • DEVELOPER
  • SOLUTIONS
  • PRICING
  • RESOURCES
  • SUPPORT
  • My Account
  • Buy (0)
  • SEARCH
  • Ask a question
  • Forums
    • Wowza ClearCaster Pro
    • Wowza Streaming Engine
    • Wowza Streaming Cloud
    • Wowza Player
    • Wowza GoCoder SDK
    • Wowza Developer Dojo
    • Topics
    • Questions
    • Articles
    • Users
    • Badges
  • Sign in
  • Community Home /
  • Wowza Streaming Engine /
  • Live Streaming and Encoders /
This question was closed May 24, 2017 at 08:51 PM by Matt Davidson for the following reason: Out of date. Please see the Wowza technical article How to use FFmpeg with Wowza Streaming Engine (MPEG-TS)
avatar image
Question by Randall Auriemma · Aug 08, 2012 at 08:58 AM · live streaming and encoders

Frequently requested FFMPEG command examples for Wowza

Example commands and information for using FFmpeg as a live video/audio encoder with Wowza Media Server.

Updated for FFmpeg Build git-a85b4a5 64-bit Static (2012-07-30)

Note: Wowza Media Systems provides these instructions on as "AS-IS" basis. FFmpeg is not a Wowza Media Systems product. If you have problems getting FFmpeg to work properly it is best to contact FFmpeg support through their forums or wiki.

The information collected here is a brief overview of common FFmpeg solutions. It is intended for an intermediate-level streaming technician who has previous experience with FFmpeg. Feel free to post solutions and hints, but please refer to the FFmpeg documentation for configuration information.

Table of Contents



  • [anchorurl=content.php?35#tutorials]Required Wowza Application Tutorials[/anchorurl]
  • [anchorurl=content.php?35#install]Installation Instructions[/anchorurl]
  • [anchorurl=content.php?35#usage]Usage[/anchorurl]
  • [anchorurl=content.php?35#inputs]Inputs[/anchorurl]
  • [anchorurl=content.php?35#outputs]Outputs[/anchorurl]
  • [anchorurl=content.php?35#inputs]Examples[/anchorurl]
  • [anchorurl=content.php?35#misc]Miscellaneous Hints[/anchorurl]




    Required Wowza Application Tutorials



    Note: In order stream to Wowza using FFmpeg you must create a Wowza live application corresponding to your chosen FFmpeg output protocol. RTMP is recommended.

    1. RTMP

    2. RTSP

    3. RTP with SDP

    4. MPEG-TS

    Installation Instructions



    Windows Installation:

    1. Download the latest static build from http://ffmpeg.zeranoe.com/builds/

    2. Unzip and copy the contents of the included folder to C:\Program Files (x86)\ffmpeg\

    3. Add "C:\Program Files (x86)\ffmpeg\bin" to your System "PATH" environment variable:

    a. Go to: Start Button -> All Programs -> Accessories. Right-click on "Command Prompt". Left-click "Run as Administrator".

    b. In the CMD window enter: setx /M PATH C:\Program Files (x86)\ffmpeg\bin\;"%PATH%"

    c. Close this CMD window.

    Linux Installation:

    Official Ubuntu Linux guide for compiling from source.

    On Linux you will have to compile from source to add support for certain codecs. The Ubuntu instructions linked here include the AAC codec libfaac instead of libvo_aacenc. In the following examples replace "libvo_aacenc" with "libfaac".

    Usage



    A basic ffmpeg command is of the following form:

    ffmpeg [INPUT OPTIONS] -i [INPUT] [OUTPUT OPTIONS] [OUTPUT]

    Parameters placed before the input apply to the input. For example, if the source is a file, prefix with the "-re" option to limit reading the input (and hence writing the output) to the encoded bitrate.

    ffmpeg -re -i [INPUT] [OUTPUT OPTIONS] [OUTPUT]

    FFmpeg supports some protocols that can be push-published directly to a Wowza application and are available for viewing automatically: RTMP, RTSP. The OUTPUT URL looks like this:

    [protocol]://[wowza-ip-address]/[application]/[streamName]

    Other protocols such as MPEG-TS, or RTP with SDP, must be "started" manually using the StreamManager, automatically using StartupStreams.xml, or programmatically with the StreamClass API. OUTPUT URL format:

    [protocol]://[wowza-ip-address]:[dstport]

    Inputs



    1. Some VOD file path examples:

    "%WMSAPP_HOME%/content/sample.mp4"

    /usr/local/WowzaMediaServer/content/bigbuckbunny_1500.mp4

    myRecording.mp3

    streamcapture.ts

    myStream.flv

    2. RTSP/RTP camera:

    rtsp://192.168.1.22/mycamera

    3. MPEG-TS stream:

    udp://localhost:1234

    4. Native RTP stream SDP file:

    unicast.sdp

    5. RTMP source:

    rtmp://[Streaming-Server-IP]:1935/vod/mp4:sample.mp4

    6. Hardware device:

    -f dshow -i video="Integrated Webcam"

    7. Linux X11 Desktop:

    -f x11grab -s wxga -r 25 -i :0.0 -sameq

    Outputs



    Note: Refer to the corresponding tutorial for your chosen live output stream type.

    1. RTMP:

    -f flv rtmp://127.0.0.1/live/myStream

    2. RTSP:

    -f rtsp -muxdelay 0.1 rtsp://127.0.0.1:1935/live/myStream

    3. RTSP (with publish password):

    -f rtsp -muxdelay 0.1 rtsp://username:secretword@127.0.0.1:1935/live/myStream

    4. RTP with SDP:

    -f rtp rtp://127.0.0.1:10000 > "%WMSAPP_HOME%/content/10000.sdp"

    -This will write an .sdp file to the Wowza content directory which can be started in Stream Manager.

    5. MPEG-TS (requires .stream file and Stream Manager):

    -vbsf h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316

    Examples



    1. Output RTMP without transcoding:

    ffmpeg -re -i "%WMSAPP_HOME%/content/sample.mp4" -c:v copy -c:a copy -f flv rtmp://127.0.0.1/live/myStream


    2. RTSP low bandwidth baseline stream:

    -H.264/AAC, Baseline profile, level 1.2, 12FPS, keyframe at least every 96 frames (8 seconds), 110kbps video, 212x120 resolution, 40kbps audio, 22.05khz, mono

    ffmpeg -re -i sample.mp4 -c:v libx264 -profile:v baseline -level:v 1.2 -r 12 -g 96 -vb 110000 -s 212x120 -c:a libvo_aacenc -ab 40000 -ar 22050 -ac 1 -f rtsp -muxdelay 0.1 rtsp://127.0.0.1/live/myStream


    3. RTSP with publish password:

    -H.264/AAC, Baseline profile, level 3.0, 24FPS, 2sec keyframe exactly, 350kbps stream, 44.1khz, stereo

    ffmpeg -re -i sample.mp4 -c:v libx264 -profile:v baseline -level 3.0 -r 24 -g 48 -keyint_min 48 -sc_threshold 0 -vb 310k -c:a libvo_aacenc -ab 40k -ar 44100 -ac 2 -f rtsp -muxdelay 0.1 rtsp://username:secretword@127.0.0.1:1935/live/myStream


    4. MPEG-TS:

    -H.264/AAC, Main profile, level 3.1, 24FPS, 4sec max keyframe interval, 404kbps constant bitrate video, 96kbps audio, 48khz, stereo

    ffmpeg -re -i sample.mp4 -c:v libx264 -profile:v main -level 3.1 -r 24 -g 96 -maxrate 404000 -minrate 404000 -bufsize 125k -c:a libvo_aacenc -ab 96000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316
    


    5. RTP with SDP:

    -Capture local hardware devices, generate SDP file in current directory. Set 15FPS source framerate, 12bit color.

    ffmpeg -y -f dshow -s 640x480 -r:v 15 -i video="Integrated Webcam":audio="Microphone (Realtek High Defini" -c:v libx264 -pix_fmt yuv420p -vb 450 -an -map 0:0 -f rtp rtp://127.0.0.1:10000 -flags +global_header -c:a libvo_aacenc -vn -map 0:1 -f rtp rtp://127.0.0.1:10002 > 10000.sdp


    Miscellaneous FFMPEG Hints



    1. Show VOD or Live stream encoding parameters for troubleshooting:

    ffprobe -show_streams [media]

    2. List available hardware device names such as webcams and microphones, for use as FFmpeg inputs:

    ffmpeg -list_devices true -f dshow -i dummy

    3. When testing short videos you may want loop your command to generate a constant test stream:

    Windows: FOR /L %% IN (0) DO YourCommand

    4. Convert .ts file (or any FFmpeg compatible input) to .mp4 container for use with Wowza VOD playback:

    ffmpeg -i input.ts -c:v copy -c:a copy output.mp4

    5. Check VOD files for keyframe alignment (Linux):

    ffprobe -output_format csv -show_frames [media] |grep I

    -For each file in your multibitrate rendition ensure the PTS and/or DTS timestamps are identical for each corresponding I-frame.

    6. Generate keyframe aligned multi-bitrate VOD rendition (Linux):

    Use this media source for testing.

    ffmpeg -y -i bigbuckbunny_1500.mp4 -c:a libfaac -ac 2 -ab 64k -c:v libx264 -preset:v veryfast -threads 0 -r 24 -g 48 -keyint_min 48 -sc_threshold 0 -x264opts no-mbtree:bframes=1 -pass 1 -b:v 286k -s 384x216 bigbuck-350k.mp4
    ffmpeg -y -i bigbuckbunny_1500.mp4 -c:a libfaac -ac 2 -ab 64k -c:v libx264 -preset:v fast -threads 0 -r 24 -g 48 -keyint_min 48 -sc_threshold 0 -x264opts no-mbtree:bframes=1 -pass 2 -b:v 286k -s 384x216 bigbuck-350k.mp4
    ffmpeg -y -i bigbuckbunny_1500.mp4 -c:a libfaac -ac 2 -ab 64k -c:v libx264 -preset:v fast -threads 0 -r 24 -g 48 -keyint_min 48 -sc_threshold 0 -x264opts no-mbtree:bframes=1 -pass 2 -b:v 836k -s 640x360 bigbuck-900k.mp4
    


    Version .08
  • Comment

    People who like this

    0 Show 0
    10 |600 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users

    1 Reply

    • Sort: 
    avatar image

    Answer by Vishal Kamboj · Oct 08, 2012 at 09:21 AM

    Hi

    I am making app using flash and wowza server in which need to publish stream using camera (as3 )from client side and need to connect with ffmpeg so

    can convert the multi streams at a time .

    My question is how to set the path rtmp to ffmpeg during publish time so can convert the streams during publish time on server .My ffmpeg on wamp sever under bin.

    Thanks

    Vishal
    Comment

    People who like this

    0 Show 1 · Share
    10 |600 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users
    avatar image Richard Lanham · Oct 08, 2012 at 07:33 PM 0
    Share
    connect with ffmpeg so can convert the multi streams at a time


    How does FFmpeg fit in? What is the goal?

    Can you diagram that?

    Webcam > Wowza > FFmpeg > client ?

    Webcam > FFmpeg > Wowza > client ?

    Richard

    Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Using Apple's QuickTime Broadcaster with Wowza Server (RTSP/RTP) 27 Answers

    does Wowza block thew Teradek Bond or Sputnik 3 Answers

    Live Streaming recording on iOS 2 Answers

    Live streaming with HTML5 3 Answers

    RTMP vs RTSP 1 Answer

    Hot Topics
    • Streaming Protocols
    • Wowza SDKs
    • AWS Hosting
    • Deployment Options
    • Load Balancing
    • Content Security
    Product Sign-in
    • Wowza Streaming Cloud
    • Wowza Player
    Under the Hood
    • Developer Tools
    • Wowza System Status
    • Test Players
    • Developer IDE
    Partners
    • Partners Overview
    • Find a Reseller
    • Channel Partner Program
    • OEM Program
    • Wowza Reseller Portal
    Company
    • About Us
    • Blog
    • News
    • Events
    • Careers
    • Customers
    • Contact Us
    Stay Connected
    Sign Up for Our Blog
    Select a Language
    • English
      • English
      • Español
      • 日本語
      • 한국어
      • हिन्दी भाषा
      • 中文
      • русский язык

    © 2005–2019 Wowza Media Systems, LLC. All rights reserved.   Terms | Privacy | Trademarks | Legal


    Enterprise
    Social Q&A

    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Forums
    • Wowza ClearCaster Pro
    • Wowza Streaming Engine
    • Wowza Streaming Cloud
    • Wowza Player
    • Wowza GoCoder SDK
    • Wowza Developer Dojo
    • Explore
    • Topics
    • Questions
    • Articles
    • Users
    • Badges