| | 169 | |
| | 170 | === Sample ffserver configuration file === |
| | 171 | |
| | 172 | {{{ |
| | 173 | # Port on which the server is listening. You must select a different |
| | 174 | # port from your standard HTTP web server if it is running on the same |
| | 175 | # computer. |
| | 176 | Port 8090 |
| | 177 | |
| | 178 | # Address on which the server is bound. Only useful if you have |
| | 179 | # several network interfaces. |
| | 180 | BindAddress 0.0.0.0 |
| | 181 | |
| | 182 | # Number of simultaneous HTTP connections that can be handled. It has |
| | 183 | # to be defined *before* the MaxClients parameter, since it defines the |
| | 184 | # MaxClients maximum limit. |
| | 185 | MaxHTTPConnections 2000 |
| | 186 | |
| | 187 | # Number of simultaneous requests that can be handled. Since FFServer |
| | 188 | # is very fast, it is more likely that you will want to leave this high |
| | 189 | # and use MaxBandwidth, below. |
| | 190 | MaxClients 1000 |
| | 191 | |
| | 192 | # This the maximum amount of kbit/sec that you are prepared to |
| | 193 | # consume when streaming to clients. |
| | 194 | MaxBandwidth 1000 |
| | 195 | |
| | 196 | # Access log file (uses standard Apache log file format) |
| | 197 | # '-' is the standard output. |
| | 198 | CustomLog - |
| | 199 | |
| | 200 | # Suppress that if you want to launch ffserver as a daemon. |
| | 201 | NoDaemon |
| | 202 | |
| | 203 | |
| | 204 | ################################################################## |
| | 205 | # Definition of the live feeds. Each live feed contains one video |
| | 206 | # and/or audio sequence coming from an ffmpeg encoder or another |
| | 207 | # ffserver. This sequence may be encoded simultaneously with several |
| | 208 | # codecs at several resolutions. |
| | 209 | |
| | 210 | <Feed feed1.ffm> |
| | 211 | |
| | 212 | # You must use 'ffmpeg' to send a live feed to ffserver. In this |
| | 213 | # example, you can type: |
| | 214 | # |
| | 215 | # ffmpeg http://localhost:8090/feed1.ffm |
| | 216 | |
| | 217 | # ffserver can also do time shifting. It means that it can stream any |
| | 218 | # previously recorded live stream. The request should contain: |
| | 219 | # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify |
| | 220 | # a path where the feed is stored on disk. You also specify the |
| | 221 | # maximum size of the feed, where zero means unlimited. Default: |
| | 222 | # File=/tmp/feed_name.ffm FileMaxSize=5M |
| | 223 | File /tmp/feed1.ffm |
| | 224 | FileMaxSize 200K |
| | 225 | |
| | 226 | # You could specify |
| | 227 | # ReadOnlyFile /saved/specialvideo.ffm |
| | 228 | # This marks the file as readonly and it will not be deleted or updated. |
| | 229 | |
| | 230 | # Specify launch in order to start ffmpeg automatically. |
| | 231 | # First ffmpeg must be defined with an appropriate path if needed, |
| | 232 | # after that options can follow, but avoid adding the http:// field |
| | 233 | #Launch ffmpeg |
| | 234 | |
| | 235 | # Only allow connections from localhost to the feed. |
| | 236 | ACL allow 127.0.0.1 |
| | 237 | |
| | 238 | </Feed> |
| | 239 | |
| | 240 | |
| | 241 | ################################################################## |
| | 242 | # Now you can define each stream which will be generated from the |
| | 243 | # original audio and video stream. Each format has a filename (here |
| | 244 | # 'test1.mpg'). FFServer will send this stream when answering a |
| | 245 | # request containing this filename. |
| | 246 | |
| | 247 | <Stream test1.mpg> |
| | 248 | |
| | 249 | # coming from live feed 'feed1' |
| | 250 | Feed feed1.ffm |
| | 251 | |
| | 252 | # Format of the stream : you can choose among: |
| | 253 | # mpeg : MPEG-1 multiplexed video and audio |
| | 254 | # mpegvideo : only MPEG-1 video |
| | 255 | # mp2 : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec) |
| | 256 | # ogg : Ogg format (Vorbis audio codec) |
| | 257 | # rm : RealNetworks-compatible stream. Multiplexed audio and video. |
| | 258 | # ra : RealNetworks-compatible stream. Audio only. |
| | 259 | # mpjpeg : Multipart JPEG (works with Netscape without any plugin) |
| | 260 | # jpeg : Generate a single JPEG image. |
| | 261 | # asf : ASF compatible streaming (Windows Media Player format). |
| | 262 | # swf : Macromedia Flash compatible stream |
| | 263 | # avi : AVI format (MPEG-4 video, MPEG audio sound) |
| | 264 | Format mpeg |
| | 265 | |
| | 266 | # Bitrate for the audio stream. Codecs usually support only a few |
| | 267 | # different bitrates. |
| | 268 | AudioBitRate 32 |
| | 269 | |
| | 270 | # Number of audio channels: 1 = mono, 2 = stereo |
| | 271 | AudioChannels 1 |
| | 272 | |
| | 273 | # Sampling frequency for audio. When using low bitrates, you should |
| | 274 | # lower this frequency to 22050 or 11025. The supported frequencies |
| | 275 | # depend on the selected audio codec. |
| | 276 | AudioSampleRate 44100 |
| | 277 | |
| | 278 | # Bitrate for the video stream |
| | 279 | VideoBitRate 64 |
| | 280 | |
| | 281 | # Ratecontrol buffer size |
| | 282 | VideoBufferSize 40 |
| | 283 | |
| | 284 | # Number of frames per second |
| | 285 | VideoFrameRate 3 |
| | 286 | |
| | 287 | # Size of the video frame: WxH (default: 160x128) |
| | 288 | # The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga, |
| | 289 | # qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga, |
| | 290 | # wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720, |
| | 291 | # hd1080 |
| | 292 | VideoSize 160x128 |
| | 293 | |
| | 294 | # Transmit only intra frames (useful for low bitrates, but kills frame rate). |
| | 295 | #VideoIntraOnly |
| | 296 | |
| | 297 | # If non-intra only, an intra frame is transmitted every VideoGopSize |
| | 298 | # frames. Video synchronization can only begin at an intra frame. |
| | 299 | VideoGopSize 12 |
| | 300 | |
| | 301 | # More MPEG-4 parameters |
| | 302 | # VideoHighQuality |
| | 303 | # Video4MotionVector |
| | 304 | |
| | 305 | # Choose your codecs: |
| | 306 | #AudioCodec mp2 |
| | 307 | #VideoCodec mpeg1video |
| | 308 | |
| | 309 | # Suppress audio |
| | 310 | #NoAudio |
| | 311 | |
| | 312 | # Suppress video |
| | 313 | #NoVideo |
| | 314 | |
| | 315 | #VideoQMin 3 |
| | 316 | #VideoQMax 31 |
| | 317 | |
| | 318 | # Set this to the number of seconds backwards in time to start. Note that |
| | 319 | # most players will buffer 5-10 seconds of video, and also you need to allow |
| | 320 | # for a keyframe to appear in the data stream. |
| | 321 | #Preroll 15 |
| | 322 | |
| | 323 | # ACL: |
| | 324 | |
| | 325 | # You can allow ranges of addresses (or single addresses) |
| | 326 | #ACL ALLOW <first address> |
| | 327 | |
| | 328 | # You can deny ranges of addresses (or single addresses) |
| | 329 | #ACL DENY <first address> |
| | 330 | |
| | 331 | # You can repeat the ACL allow/deny as often as you like. It is on a per |
| | 332 | # stream basis. The first match defines the action. If there are no matches, |
| | 333 | # then the default is the inverse of the last ACL statement. |
| | 334 | # |
| | 335 | # Thus 'ACL allow localhost' only allows access from localhost. |
| | 336 | # 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and |
| | 337 | # allow everybody else. |
| | 338 | |
| | 339 | </Stream> |
| | 340 | |
| | 341 | |
| | 342 | ################################################################## |
| | 343 | # Example streams |
| | 344 | |
| | 345 | |
| | 346 | # Multipart JPEG |
| | 347 | |
| | 348 | #<Stream test.mjpg> |
| | 349 | #Feed feed1.ffm |
| | 350 | #Format mpjpeg |
| | 351 | #VideoFrameRate 2 |
| | 352 | #VideoIntraOnly |
| | 353 | #NoAudio |
| | 354 | #Strict -1 |
| | 355 | #</Stream> |
| | 356 | |
| | 357 | |
| | 358 | # Single JPEG |
| | 359 | |
| | 360 | #<Stream test.jpg> |
| | 361 | #Feed feed1.ffm |
| | 362 | #Format jpeg |
| | 363 | #VideoFrameRate 2 |
| | 364 | #VideoIntraOnly |
| | 365 | ##VideoSize 352x240 |
| | 366 | #NoAudio |
| | 367 | #Strict -1 |
| | 368 | #</Stream> |
| | 369 | |
| | 370 | |
| | 371 | # Flash |
| | 372 | |
| | 373 | #<Stream test.swf> |
| | 374 | #Feed feed1.ffm |
| | 375 | #Format swf |
| | 376 | #VideoFrameRate 2 |
| | 377 | #VideoIntraOnly |
| | 378 | #NoAudio |
| | 379 | #</Stream> |
| | 380 | |
| | 381 | |
| | 382 | # ASF compatible |
| | 383 | |
| | 384 | <Stream test.asf> |
| | 385 | Feed feed1.ffm |
| | 386 | Format asf |
| | 387 | VideoFrameRate 15 |
| | 388 | VideoSize 352x240 |
| | 389 | VideoBitRate 256 |
| | 390 | VideoBufferSize 40 |
| | 391 | VideoGopSize 30 |
| | 392 | AudioBitRate 64 |
| | 393 | StartSendOnKey |
| | 394 | </Stream> |
| | 395 | |
| | 396 | |
| | 397 | # MP3 audio |
| | 398 | |
| | 399 | #<Stream test.mp3> |
| | 400 | #Feed feed1.ffm |
| | 401 | #Format mp2 |
| | 402 | #AudioCodec mp3 |
| | 403 | #AudioBitRate 64 |
| | 404 | #AudioChannels 1 |
| | 405 | #AudioSampleRate 44100 |
| | 406 | #NoVideo |
| | 407 | #</Stream> |
| | 408 | |
| | 409 | |
| | 410 | # Ogg Vorbis audio |
| | 411 | |
| | 412 | #<Stream test.ogg> |
| | 413 | #Feed feed1.ffm |
| | 414 | #Title "Stream title" |
| | 415 | #AudioBitRate 64 |
| | 416 | #AudioChannels 2 |
| | 417 | #AudioSampleRate 44100 |
| | 418 | #NoVideo |
| | 419 | #</Stream> |
| | 420 | |
| | 421 | |
| | 422 | # Real with audio only at 32 kbits |
| | 423 | |
| | 424 | #<Stream test.ra> |
| | 425 | #Feed feed1.ffm |
| | 426 | #Format rm |
| | 427 | #AudioBitRate 32 |
| | 428 | #NoVideo |
| | 429 | #NoAudio |
| | 430 | #</Stream> |
| | 431 | |
| | 432 | |
| | 433 | # Real with audio and video at 64 kbits |
| | 434 | |
| | 435 | #<Stream test.rm> |
| | 436 | #Feed feed1.ffm |
| | 437 | #Format rm |
| | 438 | #AudioBitRate 32 |
| | 439 | #VideoBitRate 128 |
| | 440 | #VideoFrameRate 25 |
| | 441 | #VideoGopSize 25 |
| | 442 | #NoAudio |
| | 443 | #</Stream> |
| | 444 | |
| | 445 | |
| | 446 | ################################################################## |
| | 447 | # A stream coming from a file: you only need to set the input |
| | 448 | # filename and optionally a new format. Supported conversions: |
| | 449 | # AVI -> ASF |
| | 450 | |
| | 451 | #<Stream file.rm> |
| | 452 | #File "/usr/local/httpd/htdocs/tlive.rm" |
| | 453 | #NoAudio |
| | 454 | #</Stream> |
| | 455 | |
| | 456 | #<Stream file.asf> |
| | 457 | #File "/usr/local/httpd/htdocs/test.asf" |
| | 458 | #NoAudio |
| | 459 | #Author "Me" |
| | 460 | #Copyright "Super MegaCorp" |
| | 461 | #Title "Test stream from disk" |
| | 462 | #Comment "Test comment" |
| | 463 | #</Stream> |
| | 464 | |
| | 465 | |
| | 466 | ################################################################## |
| | 467 | # RTSP examples |
| | 468 | # |
| | 469 | # You can access this stream with the RTSP URL: |
| | 470 | # rtsp://localhost:5454/test1-rtsp.mpg |
| | 471 | # |
| | 472 | # A non-standard RTSP redirector is also created. Its URL is: |
| | 473 | # http://localhost:8090/test1-rtsp.rtsp |
| | 474 | |
| | 475 | #<Stream test1-rtsp.mpg> |
| | 476 | #Format rtp |
| | 477 | #File "/usr/local/httpd/htdocs/test1.mpg" |
| | 478 | #</Stream> |
| | 479 | |
| | 480 | |
| | 481 | # Transcode an incoming live feed to another live feed, |
| | 482 | # using libx264 and video presets |
| | 483 | |
| | 484 | #<Stream live.h264> |
| | 485 | #Format rtp |
| | 486 | #Feed feed1.ffm |
| | 487 | #VideoCodec libx264 |
| | 488 | #VideoFrameRate 24 |
| | 489 | #VideoBitRate 100 |
| | 490 | #VideoSize 480x272 |
| | 491 | #AVPresetVideo default |
| | 492 | #AVPresetVideo baseline |
| | 493 | #AVOptionVideo flags +global_header |
| | 494 | # |
| | 495 | #AudioCodec libfaac |
| | 496 | #AudioBitRate 32 |
| | 497 | #AudioChannels 2 |
| | 498 | #AudioSampleRate 22050 |
| | 499 | #AVOptionAudio flags +global_header |
| | 500 | #</Stream> |
| | 501 | |
| | 502 | ################################################################## |
| | 503 | # SDP/multicast examples |
| | 504 | # |
| | 505 | # If you want to send your stream in multicast, you must set the |
| | 506 | # multicast address with MulticastAddress. The port and the TTL can |
| | 507 | # also be set. |
| | 508 | # |
| | 509 | # An SDP file is automatically generated by ffserver by adding the |
| | 510 | # 'sdp' extension to the stream name (here |
| | 511 | # http://localhost:8090/test1-sdp.sdp). You should usually give this |
| | 512 | # file to your player to play the stream. |
| | 513 | # |
| | 514 | # The 'NoLoop' option can be used to avoid looping when the stream is |
| | 515 | # terminated. |
| | 516 | |
| | 517 | #<Stream test1-sdp.mpg> |
| | 518 | #Format rtp |
| | 519 | #File "/usr/local/httpd/htdocs/test1.mpg" |
| | 520 | #MulticastAddress 224.124.0.1 |
| | 521 | #MulticastPort 5000 |
| | 522 | #MulticastTTL 16 |
| | 523 | #NoLoop |
| | 524 | #</Stream> |
| | 525 | |
| | 526 | |
| | 527 | ################################################################## |
| | 528 | # Special streams |
| | 529 | |
| | 530 | # Server status |
| | 531 | |
| | 532 | <Stream stat.html> |
| | 533 | Format status |
| | 534 | |
| | 535 | # Only allow local people to get the status |
| | 536 | ACL allow localhost |
| | 537 | ACL allow 192.168.0.0 192.168.255.255 |
| | 538 | |
| | 539 | #FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico |
| | 540 | </Stream> |
| | 541 | |
| | 542 | |
| | 543 | # Redirect index.html to the appropriate site |
| | 544 | |
| | 545 | <Redirect index.html> |
| | 546 | URL http://www.ffmpeg.org/ |
| | 547 | </Redirect> |
| | 548 | }}} |