FFmpeg - Different (pre)settings.

Discussion in 'iPiMP' started by j1nx, November 13, 2010.

  1. j1nx

    j1nx Portal Pro

    Joined:
    July 16, 2005
    Messages:
    233
    Likes Received:
    10
    Ratings:
    +10 / 0
    I believe a couple of people have difficulties with live streaming and the ffmpeg settings chosen for the live streaming. Some people find them to high for there bandwidth, some people want more etc etc.

    Until Cheezey implements either a manual option to choice your bandwith or true multi-bit rate, I think it is wise that we keep our tweaks, tips and questions about this settings centralized. (this or some sticky topic)

    The following settings are distributed with the latest 5.1.0 version of iPiMP

    CONFIX>XML
    Code (Text):
    1.  
    2. <appconfig>
    3.   <transcoders>
    4.     <transcoder name="LiveTV" usetranscoding="1" filename="&quot;D:/Program Files/iPiMP/Utilities/ffmpeg\ffmpeg.exe&quot;" args="-i - -threads 0 -re -vcodec libx264 -fpre &quot;D:/Program Files/iPiMP/Utilities/ffmpeg/ffpresets/libx264-iPiMP.ffpreset&quot; -b 256k -s 480x272 -aspect 480:272 -acodec libfaac -ac 2 -ab 64k -ar 48000 -ac 2 -async 2 -f ism http://192.168.254.9:88/SmoothStream.isml/Streams(SmoothStream)?dvr_window_length=15" inputmethod="2" outputmethod="4" />
    5.     <transcoder name="Recording" usetranscoding="1" filename="&quot;D:/Program Files/iPiMP/Utilities/ffmpeg\ffmpeg.exe&quot;" args="-ss 420 -i &quot;{0}&quot; -threads 0 -re -vcodec libx264 -fpre &quot;D:/Program Files/iPiMP/Utilities/ffmpeg/ffpresets/libx264-iPiMP.ffpreset&quot; -b 256k -s 480x272 -aspect 480:272 -acodec libfaac -ac 2 -ab 64k -ar 48000 -ac 2 -async 2 -f ism http://192.168.254.9:88/SmoothStream.isml/Streams(SmoothStream)?dvr_window_length=15" inputmethod="0" outputmethod="4" />
    6.     <transcoder name="TVSeries" usetranscoding="1" filename="&quot;D:/Program Files/iPiMP/Utilities/ffmpeg\ffmpeg.exe&quot;" args="-i &quot;{0}&quot; -threads 0 -re -vcodec libx264 -fpre &quot;D:/Program Files/iPiMP/Utilities/ffmpeg/ffpresets/libx264-iPiMP.ffpreset&quot; -b 256k -s 480x272 -aspect 480:272 -acodec libfaac -ac 2 -ab 64k -ar 48000 -ac 2 -async 2 -f ism http://192.168.254.9:88/SmoothStream.isml/Streams(SmoothStream)?dvr_window_length=15" inputmethod="0" outputmethod="4" />
    7.     <transcoder name="Radio" usetranscoding="1" filename="&quot;D:/Program Files/iPiMP/Utilities/ffmpeg\ffmpeg.exe&quot;" args="-i - -threads 0 -re -acodec libfaac -ac 2 -ab 64k -ar 48000 -ac 2 -async 2 -f ism http://192.168.254.9:88/SmoothStream.isml/Streams(SmoothStream)?dvr_window_length=15" inputmethod="2" outputmethod="4" />
    8.   </transcoders>
    9. </appconfig>
    10.  
    libx264-iPiMP.ffpreset
    Code (Text):
    1.  
    2. coder=0
    3. flags=+loop
    4. cmp=+chroma
    5. partitions=+parti4x4+parti8x8+partp8x8
    6. me_method=umh
    7. subq=5
    8. me_range=16
    9. g=100
    10. keyint_min=50
    11. sc_threshold=0
    12. i_qfactor=0.71
    13. qmin=10
    14. qmax=51
    15. refs=1
    16. trellis=2
    17. deblockalpha=0
    18. deblockbeta=0
    19. crf=24
    20. level=30
    21.  

    To kick of with my question and problems;



    My mepo machine only has a P4 2.4 GHz, so is not capable of live streaming. with the above settings, CPU spikes to 100% and encoding time of 1 second of video is close to 1 second if not higher. It means it needs buffering now and then.

    What can I do to tweak the settings, lowering the encoding speed under 1 second per second. I don't give anything about the bandwidth. Wifi is fast enough and everything is connected to the outside world by a glass fibre 50/50 connection. I just want to go a bit easy on the CPU.
     
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. cheezey

    cheezey Community Plugin Dev

    Joined:
    August 26, 2004
    Messages:
    1,560
    Likes Received:
    315
    Occupation:
    Technical architect
    Location:
    West Yorks, UK
    Ratings:
    +315 / 0
    Home Country:
    United Kingdom United Kingdom
    You could try changing libx264-iPiMP.ffpreset to

    Code (Text):
    1. coder=0
    2. bf=0
    3. flags2=-wpred-dct8x8
    4. wpredp=0
    5. sc_threshold=0
    6.  
    this is just libx264-baseline (needed for the iPhone) with sc_threshold=0 added (on advice), this may reduce the work your processor has to do.

    The other settings in libx264-iPiMP.ffpreset were collated from other forums discussing iPhone ffmpeg settings a couple of years ago - most are for h264 encoding and I'm not sure what they do :)
     
  4. j1nx

    j1nx Portal Pro

    Joined:
    July 16, 2005
    Messages:
    233
    Likes Received:
    10
    Ratings:
    +10 / 0
    Thx, cheezey, but ias doesn't really work (no manifest file is created)

    Did some reading, following link explains most stuff;
    x264 ffmpeg mapping and options guide - Linux Encoding


    I removed the "+partp8x8" from the partition settings,
    Changed the "me_method" to "hex" variant,
    Lowered the "me_range" to 8

    Those settings will do the most for speed, making it work on older systems. At the cost of quality off course. You could play around with the settings to find the threshold for every other machine.

    So my libx264-iPiMP.ffpreset now looks like;
    Code (Text):
    1.  
    2. coder=0
    3. flags=+loop
    4. cmp=+chroma
    5. partitions=+parti4x4+parti8x8
    6. me_method=hex
    7. subq=5
    8. me_range=8
    9. g=100
    10. keyint_min=50
    11. sc_threshold=0
    12. i_qfactor=0.71
    13. qmin=10
    14. qmax=51
    15. refs=1
    16. trellis=2
    17. deblockalpha=0
    18. deblockbeta=0
    19. crf=24
    20. level=30
    21.  
    EDIT:
    There appears to be an inconstancy in the settings;
    In the settings;
    Code (Text):
    1.  
    2. coder=0
    3. trellis=2
    4.  
    Either coder needs to be "1" or trellis needs to be "0".
     
  5. gibber
    • Premium Supporter

    gibber MP Donator

    Joined:
    October 8, 2009
    Messages:
    35
    Likes Received:
    2
    Ratings:
    +2 / 0
    Home Country:
    Canada Canada
    Show System Specs
    I have similar problems when trying to stream high def files. Is there any way to enable DXVA (gpu assisted) conversion of the file?

    My MEPO setup does a nice job of playing up to 1080p video, but only when DXVA is enabled..
     
  6. j1nx

    j1nx Portal Pro

    Joined:
    July 16, 2005
    Messages:
    233
    Likes Received:
    10
    Ratings:
    +10 / 0
    Nah, I think more is going on here. I still have problems encoding the content on a live basis with the "-re" option, but even with all settings adjusted to the lowest settings possible the process is still not fast enough.

    I'm still struggling to find out if it is FFMpeg or the smoothstream module. One of them is not optimal. It is not my bandwidth. I'm testing on WiFi, and to the outside world I have a 50 Mbit up and down glass fiber connection (is only 4 Mbit less)

    In the next coming days I plan to do some tests with other ffmpeg builds and the open source segmenter (httpsegmenter - Project Hosting on Google Code), which is way longer available then the codeshop solutions mp4split. The last ffmpeg build can handle the live http iphone segmented streaming option.
     
  7. cheezey

    cheezey Community Plugin Dev

    Joined:
    August 26, 2004
    Messages:
    1,560
    Likes Received:
    315
    Occupation:
    Technical architect
    Location:
    West Yorks, UK
    Ratings:
    +315 / 0
    Home Country:
    United Kingdom United Kingdom
    Getting a windows segmenter working was my first option (about a year ago) and I eventually managed to get one compiled for windows, not with any of the improvements listed on the above site though. The only downside with this option as I see it now it that the segmenting solution supports Apple's HTTP streaming, so us iPhone/iPad users are happy :) But everyone else isn't :( Codeshop's SmoothStreaming gives you Apple, Flash & Silverlight streaming all from the same process.
     
  8. j1nx

    j1nx Portal Pro

    Joined:
    July 16, 2005
    Messages:
    233
    Likes Received:
    10
    Ratings:
    +10 / 0
    Yes, I know. The segmenter is far from optimal. But yesterday I already did a quick test.

    Streamed one of my Bones episodes with iPiMP, looked like the whole process is behind, takes a lot of time to start and the encoding/segmenting process can't keep up, so you have the buffering every 10-20 seconds or so.

    Then I downloaded the segmenter from the above site, unpacked it into the same directory as iPimp. Downloaded an automated build of one of the latest ffmpeg windows versions from Automated FFmpeg Builds (I know...., but I don't want to setup a building environment) Copied the ffmpeg.exe from that build into the segmenter directory and editted the included start.bat to stream the same Bones episode. Encoding and streaming almost immediately starts and it is (WAY) faster, even with the settings untweaked whcih means a LOT more quality. Starting the bat and immediately opening the stream at the ipod, makes it running smoothly without hickups, buffering and a lot more quality?

    Still, as I replaced both, the segmenter and the ffmpeg build, I still don't know which one should be looked at. But at least I know, the machine and all should be capable of doing it.


    EDIT: hmmmm, while clicking around on that website about the windows build of segmenter I came across the scope of work - project of that segmenter. http://sm.espend.de/

    Maybe I'm silly, but would it not be a lot simpler to write a mediaportal module, just like the DVBviewer module. Look at this picture; (shows what it does)
    http://sm.espend.de/sites/default/files/resize/streamode-300x188.png

    EDIT2: Nope, let's cut the crap. Why would anyone want to install a full drupal system just to stream some stuff. But I think it is wise to have a look at his framework. Multiple sources going into the system, creating multiple frontends. Web, mobile and even dreambox or popcorn hour frontend.
     
  9. cheezey

    cheezey Community Plugin Dev

    Joined:
    August 26, 2004
    Messages:
    1,560
    Likes Received:
    315
    Occupation:
    Technical architect
    Location:
    West Yorks, UK
    Ratings:
    +315 / 0
    Home Country:
    United Kingdom United Kingdom
    I'll download the streamode product and see what its like.

    In the meantime I've uploaded an ffmpeg with dxva support - could you try that?
     
  10. j1nx

    j1nx Portal Pro

    Joined:
    July 16, 2005
    Messages:
    233
    Likes Received:
    10
    Ratings:
    +10 / 0
    Thanks Cheezey.

    Did some testing, and I guess I am at the exact limit of my hardware with the setup provided by you.

    For the testing, I skipped the live tv for a moment and went for an avi file. This ensures all test are at the same conditions. I also removed the "-re" (encoding at movie framerate)

    1) Smoothstream + ffmpeg_ipimp_orig > With all lowest settings, I'm able to get a 20 fps encoding. The avi is a 25 fps PAL movie, so not enought
    2) Smoothstream + ffmpeg_ipimp_dxva > 21-22 fps, so not a big difference. Thought that dxva was for decoding anyway instead of encoding, but am not an expert.
    3) Smoothstream + ffmpeg_static_latest svn build > 23 fps, slowing going down to 22 fps. Still not enough
    4) segmenter + ffmpeg (any version) > 27 fps, which is enough for the 25 fps PAL movie. second test with the "-re" option added shows 23 fps???, but ran a long term test and I can as good as watch the whole movie without stuttering or buffering (tested for 30 minutes)

    So I guess the smoothstream module from codeshop is a bit of a overkill, but as all my fps target are so close to the at least required 25 fps I guess I'm touching the limit of this old P4 system.

    For other people who want to tweak or have problems. The ffmpeg output, including all the fps statistics are outputted to the apache error.log You can check if there if the encoding process is enough for the framerate of the content (pal=25fps, ntsc=?)

    Thx, so far.
     
  11. Lolento

    Lolento Portal Pro

    Joined:
    September 9, 2006
    Messages:
    150
    Likes Received:
    7
    Ratings:
    +7 / 0
    Home Country:
    United States of America United States of America
    can somebody explain how to decrease the bitrate of the stream?

    also, is there a method for iPimp to differentiate between 3g and wifi connections?
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!