Opened 9 years ago

Closed 7 years ago

#1275 closed defect (fixed)

ffserver x264 presets

Reported by: burek Owned by: mastered
Priority: normal Component: ffserver
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


ffserver is started with a simple config file (ffserver.conf) that defined only libx264 flv output and ffmpeg is started to feed the ffserver after which the error is received, which I don't know how to get around, because I don't know how to set "-vpre" or "-preset" in ffserver.conf file (when I try to set -vpre or -preset at ffmpeg's command line, I get the same error as provided here):


Port 8090
CustomLog -

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

<Stream test1.flv>
        Feed feed1.ffm
        Format flv
        VideoCodec libx264
        VideoFrameRate 25
        AVOptionVideo flags +global_header

<Stream stat.html>
        Format status
        ACL allow localhost
        ACL allow

<Redirect index.html>

the result:

# ffserver -d -f ffserver.conf &
# ffmpeg -i -vf yadif http://localhost:8090/feed1.ffm
ffmpeg version git-2012-05-03-28d37f7 Copyright (c) 2000-2012 the FFmpeg developers
  built on May  3 2012 13:43:26 with gcc 4.6.3
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 17.101 / 54. 17.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
[mpeg2video @ 0x2232c40] mpeg_decode_postinit() failure
    Last message repeated 5 times
[mpegts @ 0x222d120] max_analyze_duration 5000000 reached at 5016000
[mpegts @ 0x222d120] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from '':
  Duration: N/A, start: 1787.574700, bitrate: 15256 kb/s
  Program 1714
    Stream #0:0[0x58c]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 15000 kb/s, 25.82 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x596]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 256 kb/s
[buffer @ 0x2428500] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:64/45 sws_param:flags=2
[scale @ 0x2233f60] w:720 h:576 fmt:yuv420p sar:64/45 -> w:160 h:128 fmt:yuv420p sar:64/45 flags:0x4
[libx264 @ 0x2277080] broken ffmpeg default settings detected
[libx264 @ 0x2277080] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x2277080] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x2277080] speed presets are listed in x264 --help
[libx264 @ 0x2277080] profile is optional; x264 defaults to high
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
    Stream #0:0: Video: h264, yuv420p, 160x128 [SAR 64:45 DAR 16:9], q=2-31, 128 kb/s, 1000k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Generally, when I start ffmpeg only (without ffserver) no matter what libx264 options I give at cmd line, ffmpeg will fill out other (missing) options, like bitrate, width/height, etc with some default values. When I use ffserver with same ffmpeg cmd lines, I usually get this kind of "vpre error" mentioned above. How can I work around that error?

Please help, thanks in advance.

Change History (14)

comment:1 by Riccardo, 9 years ago

same here with git a5c1a0c, tested with windows and linux

(see also duplicate #1461)

comment:2 by Riccardo, 9 years ago

adding a few properties seems to do the trick:

AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionVideo qmin 10
AVOptionVideo qmax 51

comment:3 by Riccardo, 9 years ago

however vlc and mplayer seem unable to decode the stream.. maybe some settings are wrong?

comment:4 by Riccardo, 9 years ago

quick update: with a flv player the streaming seems to work.. also tried with rtmp and it's good

comment:5 by Janis, 8 years ago

So is there any improvement on this situation?

Has there been any development on ffserver that would allow users to set a preset and profile for x264? Also it would be great to tune..

At least webm streaming seems to be working..

comment:6 by Janis, 8 years ago

Component: undeterminedFFserver

comment:7 by Janis, 8 years ago

Priority: normalimportant
Version: unspecifiedgit-master

comment:8 by Carl Eugen Hoyos, 8 years ago

Priority: importantnormal

Is this a regression?

comment:9 by mastered, 8 years ago

Analyzed by developer: set
Owner: set to mastered
Reproduced by developer: set
Status: newopen

comment:10 by Carl Eugen Hoyos, 8 years ago

Analyzed by developer: unset

comment:11 by tstepnia, 8 years ago

Just to simplify: how do we pass following in ffserver.conf

-preset ultrafast -pix_fmt yuv420p

comment:12 by burek, 8 years ago

According to this ticket #2954 "-pix_fmt yuv420p" should be:

PixelFormat yuv420p

I'm not sure about "-preset" (actually "-preset:v")

comment:13 by Stefano Sabatini, 7 years ago

This is due to a limitation in ffserver, only few parameters can be set from the configuration file and no codec private options.

To workaround the issue at the moment it is required to use the override_ffserver on the ffmpeg side and set the option on the ffmpeg commandline. A proper fix would require the extension of the ffm format in order to be able to set generic option names.

comment:14 by mastered, 7 years ago

Resolution: fixed
Status: openclosed

Fixed by 745730c9c208c40f800d5d71ffa39aceab6ce044
Further improvements are committed later.

Note: See TracTickets for help on using tickets.