Wowza Community

Encoding with FFmpeg for VOD streaming

Can anyone post a successful ffmpeg command and contents of the preset file for encoding for wowza iPhone and RTSP VOD streaming, also provide the ffmpeg version that you use. Thank you.

I believe there is a post from me in this thread:

http://www.wowza.com/community/t/-/516&highlight=ffmpeg

Charlie

I’ve had the best success with this ffmpeg command. I’m not sure where I picked up but it has served me well for iPad and iPhone.

ffmpeg -threads 4 -y -i inputfile.mov -r 29.97 -vcodec libx264 -s 480x360 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -me_method umh -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 outfile.mp4

ffmpeg details:

FFmpeg version SVN-r23622, Copyright © 2000-2010 the FFmpeg developers

built on Jun 16 2010 05:12:07 with gcc 4.4.3

configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab

libavutil 50.19. 0 / 50.19. 0

libavcodec 52.76. 0 / 52.76. 0

libavformat 52.68. 0 / 52.68. 0

libavdevice 52. 2. 0 / 52. 2. 0

libavfilter 1.20. 0 / 1.20. 0

libswscale 0.11. 0 / 0.11. 0

libpostproc 51. 2. 0 / 51. 2. 0

Wow, I will be sure not to waste your time anymore.

Charlie

Not sure what trouble you’re having encoding for RTSP or iPhone – if you’d care to elaborate, that would help.

I’ve had good success encoding for both RTSP and iPhone using a command I derived from the thread Charlie linked to:

ffmpeg -i source.mov -s 640x480 -y -strict experimental -acodec libfaac -ab 64k -ac 1 -ar 44100 -vcodec libx264 -vpre default -vpre ipod640 -r 15 -g 75 -b 175k -threads 64 -async 1 output.mp4

You should be able to adjust it to your needs – the only option that wasn’t readily apparent to me was “-g” which is their keyframe interval.

Here’s my ffmpeg info:

FFmpeg version SVN-r23746, Copyright © 2000-2010 the FFmpeg developers

built on Jun 24 2010 10:34:48 with gcc 4.2.1 (Apple Inc. build 5659)

configuration: --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64 --enable-libfaac --enable-libx264 --enable-gpl --enable-nonfree

libavutil 50.19. 0 / 50.19. 0

libavcodec 52.78. 0 / 52.78. 0

libavformat 52.71. 0 / 52.71. 0

libavdevice 52. 2. 0 / 52. 2. 0

libavfilter 1.20. 0 / 1.20. 0

libswscale 0.11. 0 / 0.11. 0

Installed on a Snow Leopard Mac using this guide:

http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html

Charlie, Your post is for other browsers than iPhone and RTSP to mobile devices. Let other people respond. I am a programmer, not video encoder/decoder. I have no knowledge of the different paramenters in FFmpeg and most others don’t either. If someone has found a successful command and settings for FFmpeg to properly encode the content, please post it. No reason for everyone to reinvent the wheel, if we can share our experiences. It is better to spend the time on configuring the server for streaming and programming the applications to serve those streaming videos instead of doing trial and error with ffmpeg configurations.

Okie-Doke, I am still hoping, other people will respond. The problem with FFmpeg is that the latest version is not necessarily the best one. Some features of it work and some don’t. Need someone that found version that works well and found settings that produce good results when streamed with wowza on iPhone and RTSP devices. I hope there is someone out there willing to share the informaion.

Thank you for your replies. The problem is that I use Windows 2003 Server platform, not Linux. I was hoping to use one of the ffmpeg Win32 builds, but those that I tried just freeze when reading different .avi files. Some of the old versions of ffmpeg work (without freezing), but there is another issue: I am trying to use -ss and -t functions and that results with the audio out of sync with video - there are many people in different discussion boards trying to find a solution to this problem unsuccessfully. If there is no other suggestion from you guys, I will try looking for other command line programs that can do both cut videos and encode it to similar resulting parameters as from ffmpeg. If you know about any other command line tools that would work on well on windows platform, please let me know. I know, there are plenty, but I greatly appreciate all advice.

When you guys encoded with the above settings, did you look at the command line window while it was encoding to notice the actual fps being encoded? Was it actually encoding for you with 15fps or 29.97fps? For me, regardless what I set the -r to, ffmpeg does not seem to care and endodes in variable fps rates varying from 30fps to 40 fps which is not good because some mobile devices can only handle 15 fps and ffmpeg does not seem to care what you set the -r to, it encodes in whatever fps rate it wants.

Does anyone know how to fix the fps?

Charlie, you have been playing with the ffmpeg, did you figure this out? From your other post, I remember reading that you had some problems with this as well. I need a command line tool, so other software packages won’t work for me.

Thanks for the ignorance Charlie…