[FFmpeg-devel] [PATCH] fix unconditional H264 references to SVQ3

Howard Chu hyc
Sat May 22 10:42:35 CEST 2010


Howard Chu wrote:
> I ran into this while building a stripped down ffserver for my Android phone.
>
> FFserver version SVN-r23210, Copyright (c) 2000-2010 the FFmpeg developers
>     built on May 22 2010 00:52:56 with gcc 4.3.1
>     configuration: --disable-doc --disable-ffmpeg --disable-ffplay
> --disable-ffprobe --disable-avdevice --disable-swscale --disable-avfilter
> --enable-small --disable-everything --enable-decoder=aac --enable-decoder=h264
> --enable-protocol=rtp --enable-protocol=rtsp --enable-protocol=http --cc=agcc
> --enable-cross-compile --arch=armv5te --target-os=gnu --enable-parser=aac
> --enable-parser=h264 --enable-muxer=rtp --enable-demuxer=flv --enable-ffserver
> --enable-protocol=tcp --enable-protocol=udp
>
> Even though there's a configure flag for SVQ3, these references weren't
> honoring it. Fixed by this patch.

And just to explain, for those wondering... This is part of my scheme to 
stream other media in realtime to the phone, which only supports RTSP/RTP/UDP. 
I have a separate server with a full ffmpeg/ffserver install. I fetch 
arbitrary streams using ffmpeg and feed them to ffserver, transcoding to an 
H264/AAC combination that the Android phone can play. This ffserver then 
serves the stream out as FLV over HTTP. I run a stripped down ffserver on the 
phone to fetch this FLV stream, and re-stream as RTP over localhost which my 
phone's media player can then play.

The reason for all these contortions is because the phone's only other 
supported input format is MP4/3GP and I can't stream those in realtime over 
HTTP - you need the entire file first so the moov atom can be constructed. And 
I don't just point the phone's RTSP client at the first ffserver, because the 
RTP traffic over UDP loses too many packets over the cellphone network. And I 
don't just point the original ffmpeg at a file served by a regular HTTP server 
because an HTTP server streaming a static file will only send as many bytes as 
the file contained at the time the server opened/stat'd the file, while ffmpeg 
would be extending the file as it streamed in.

So, for reference, here's the ffserver.conf for the main server:
####
Port 8080
BindAddress 0.0.0.0
MaxHTTPConnections 1000
MaxClients 200
MaxBandwidth 10000
CustomLog -

<Feed feed1.ffm>
# ffmpeg -i rtmp://foo/bar http://localhost:8080/feed1.ffm
File /tmp/feed1.ffm
FileMaxSize 2000M
</Feed>

<Stream test.flv>
Format flv
Feed feed1.ffm

NoLoop

VideoCodec libx264
VideoBitRate 200
VideoFrameRate 24
VideoSize 480x272
AVOptionVideo coder 0
AVOptionVideo bf 0
AVOptionVideo flags2 +mixed_refs+fastpskip
AVOptionVideo flags +loop
AVOptionVideo cmp +chroma
AVOptionVideo partitions +parti8x8+parti4x4+partp8x8+partb8x8
AVOptionVideo me_method hex
AVOptionVideo subq 7
AVOptionVideo me_range 16
AVOptionVideo g 250
AVOptionVideo keyint_min 25
AVOptionVideo sc_threshold 40
AVOptionVideo i_qfactor 0.71
AVOptionVideo b_strategy 1
AVOptionVideo qcomp 0.6
AVOptionVideo qmin 10
AVOptionVideo qmax 51
AVOptionVideo qdiff 4
AVOptionVideo refs 3
AVOptionVideo directpred 1
AVOptionVideo trellis 1
AVOptionVideo flags2 +mixed_refs+fastpskip
AVOptionVideo wpredp 0
AVOptionVideo flags +global_header

AudioCodec libfaac
AudioBitRate 32
AudioChannels 2
AudioSampleRate 22050
AVOptionAudio flags +global_header

</Stream>

<Stream stat.html>
Format status

ACL allow localhost
</Stream>
####

And the ffserver.conf on the G1

####
Port 8080
RTSPPort 554
BindAddress 127.0.0.1
MaxHTTPConnections 10
MaxClients 2
MaxBandwidth 10000
CustomLog -

<Stream test.mp4>
Format rtp
File "http://my.server:8080/test.flv?date=2000-01-01T00:00:00"
</Stream>

<Stream stat.html>
Format status

ACL allow localhost
</Stream>
####

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/



More information about the ffmpeg-devel mailing list