maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Request: TCPMP (https://talk.maemo.org/showthread.php?t=19989)

josiahg777 2008-06-01 18:57

Re: Request: TCPMP
 
Quote:

Originally Posted by iliaden (Post 180784)
if you find one - tell me!
other calculators I miss: spacetime (great graphing tools, as well as the capacity to derivate, integrate, take limits and matrices)


The new Garnet VM supports mathLib so both easyCalc and spacetime should work now! I'm looking forward to trying them when I get home :)

Oh and thanks for the mplayer line! I no longer miss TCPMP :P
I bundled it into a quick dirty shell-script that I'll post as soon as I get home :) It's kind of a work in progress but it works :)

josiahg777 2008-06-02 00:47

Re: Request: TCPMP
 
Okay, here we go :)

Download, remove the ".txt" from the end, drop it in /usr/bin and chmod +x it :)

This script when called by mplayer-opt <FILENAME> will read the size of the video and choose the appropriate low-res for it. It will then echo what resolution it chose and then call mplayer with the the optomized flags (-hardframedrop -noslices etc).

It's a work in progress and I plan on adding options to it and maybe some better optomizations if I can find them. It's also my first shell script ever so any feedback/corrections/suggestions are more than welcome!

EDIT: UPDATE AVAILABLE, SCROLL DOWN

iliaden 2008-06-02 11:17

Re: Request: TCPMP
 
good idea; has a few small [or maybe crucial] problems:
1) you measure the video by the width ONLY. usually the problems occur not only due to the resolution, but also due to the bitrate and the amount of complete image changes per time (fast-paced action).
2) just for me:
Code:

-lavdopts "$FAST"lowres="$FULL"
does the -lavdopts fast actually help? I never noticed any difference on all my videos.

3)
Code:

mplayer -really-quiet -noslices -hardframedrop -lavdopts "$FAST"lowres="$FULL" -vo omapfb "$NAME"
why the
Code:

-vo omapfb
?
is this really necessary? I never had any problems with the video decoder, and I thought that MPlayer usually choses optimally...

4)
Code:

if [ $WIDTH -gt 1600 ]
then setting lowres ON, 1/8 resolution
elif [ $WIDTH -gt 800 ]
then setting lowres ON, 1/4 resolution
elif [ $WIDTH -gt 400 ]
then setting lowres ON, 1/2 resolution
else setting lowres OFF
fi

the width of the screen is 800. not all the videos whose width is between 400 and 800 would lag. as I said, it also depends on the bitrate and the number of complete scene changes per second. Is there any way to check the bitrate of a file (and get the output usable in a script)? If so, the script could be enabled iff the video bitrate > ~900 kbps, or if the total bitrate > 1024kbps. And just to verify, these values sound reasonable to all?

oh, and one last thing:
Quote:

Known Issues: This script will not work with videos whose aspect ratio has not been declared
unless the video file is broken, how is this possible?

Jaffa 2008-06-02 12:08

Re: Request: TCPMP
 
Quote:

Originally Posted by iliaden (Post 187914)
Is there any way to check the bitrate of a file (and get the output usable in a script)?

Yes, tablet-encode does exactly that: see the mediaInfo() function in https://garage.maemo.org/plugins/scm...74&view=markup

HTH,

Andrew

josiahg777 2008-06-04 06:57

Re: Request: TCPMP
 
Quote:

Originally Posted by iliaden (Post 187914)
does the -lavdopts fast actually help? I never noticed any difference on all my videos.

I don't actually know if it helps or not, it was suggested in the MPlayer documentation and it certainly can't hurt. The MPlayer documentation does say that it will only make a difference using some MP4 and .H264 codecs.

Quote:

why the
Code:

-vo omapfb
?
Hmmm... Good point. I think omapfb is the default anyway. The only reason it's still there is because I was experimenting with different video outs and ended up just setting it back to omapfb. It's been removed.

Quote:

the width of the screen is 800. not all the videos whose width is between 400 and 800 would lag.
This is very true. I was simply following the guidelines for video encoding posted here: http://maemo.org/community/wiki/VideoEncoding/
Feel free to suggest a better sliding scale :)

Quote:

Is there any way to check the bitrate of a file (and get the output usable in a script)?
Yes, actually, it's quite easy. Just add the following to the awk line:
Code:

/ID_VIDEO_BITRATE/ { print substr( $0, 18, length($0) )
I'm adding support for this to the script, I don't quite know what to do with it though. I added it as a setting to determine the threshold resolution for resizing the video. I'm not entirely convinced this is the correct way to implement it.

Quote:

If so, the script could be enabled iff the video bitrate > ~900 kbps, or if the total bitrate > 1024kbps. And just to verify, these values sound reasonable to all?
I don't actually have much experience with bitrate values but sure, I'll go ahead and add these.
EDIT: I also read in the video's FPS but I don't currently do anything with it. What should I do with it?

Quote:

oh, and one last thing:
unless the video file is broken, how is this possible?
I don't know actually... But -lavdopts lowres refused to re-size some of the videos I downloaded (for reference they were Apple TV ads) complaining that "No suitable aspect ratio was found". Hence, I stuck that line in to cover my butt.

Okay, here's version 0.2: mplayer-opt
I updated the link in the previous post as well.

I really need to learn about debian packaging so I can bundle this into an installable .deb

bunanson 2008-06-04 07:35

Re: Request: TCPMP
 
I ran it on xterm, /bin/ash: illegal option -

?

n810/2008OS

bun

josiahg777 2008-06-04 07:54

Re: Request: TCPMP
 
Crap! That'll teach me to upload stuff at one in the morning. Sorry about that, I fixed the error :) It should work fine now :)

bunanson 2008-06-04 07:57

Re: Request: TCPMP
 
For some reason, I can only copy your script and make one out of it. Your link does not seem to be able to dl, or, even worst, I do not know how to dl from your link :)

I redl/rerun again, and this time...........same error. Sorry,


bun

josiahg777 2008-06-04 08:04

Re: Request: TCPMP
 
EDIT: Okay try this one: mplayer-opt
Download and run:

tar -xzvPf Mopt.tar

on it :)
Then:
cd /usr/bin
chmod +x mplayer-opt

FIXED: Unfortunately it's my server's problem :( I don't own the webspace directly, I sublease it from one of my friends so I don't have permission to fix it. Try right clicking on it and selecting "Save as" ?

iliaden 2008-06-04 11:12

Re: Request: TCPMP
 
I believe that in the code you are using, FPS should not matter.
I experimented a bit with -framedrop and -hardframedrop, while keeping an eye on the original FPS. here's what I got:
- on low bitrate videos, all FPS play well, and all the slightest lags can be removed by -framedrop.

- on high bitrate videos:
1) -framedrop increases performance, reducing the lag, but not always entirely
2) -harframedrop reduces the lag even further, but OFTEN screws up colors, by keeping the previous ones.

now, concerning FPS: unless the video has been anyhow converted, It's between 27 and 30 FPS. MPlayer -quiet -framedrop would play all of those videos, with the bitrate < 900kbps without any problem. The problem only occurs with the videos with actions scenes, with a larger amount of key frames (those that need to be loaded entirely, not just the modifications to the previous scene). I have no clue how to determine this in a file, specially if it's only a small segment of it. The theoretical ideal would be that the mplayer parameters would change in the middle of the clip, but this IS impossible.

my suggestion (made at 7 am, might be crazy):
- if the video has already been somehow converted (i.e. framerate < 12 fps), just run mplayer -quiet -framedrop file
- if the video has not yet been converted:
- check bitrate. if < 750 bps, "mplayer -quiet -framedrop"
if 750 > < 900, look at resolution. if width > 530, add lowres=1
if width < 530, "mplayer -quiet -framedrop"
if > 900, look at resolution. if width > 800, add lowres, depending on bitrate
if width < 800, use lowres=1|2, depending on bitrate.

this idea sounds to create quite a long code, yet I can't yet figure out how to place a cycle, since the requirements are different for each step.
anyways, does this idea sounds to optimize something?

Ilia


All times are GMT. The time now is 00:08.

vBulletin® Version 3.8.8