Hydrogenaudio Forums

Hosted Forums => foobar2000 => Support - (fb2k) => Topic started by: Starfox on 2019-02-24 11:15:58

Title: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-24 11:15:58
Hi,

i have trouble with Foobar2000 1.4.2.

Mp3 Duration in Windows 10 64bit is 1 second shorter as showed in Foobar.

explained in Win 10 Explorer it shows 1 Minute and 07 Seconds, in Foobar the same File is 1Minute and 08 Seconds.

It´s a convertet Stereo FLAC File from Audials 2019 with DBPoweramp converted to MP3 in VBR V1 Joint Stereo.

But the same Problem i have with the original FLAC File, in Foobar it shows 1 sec shorter.

VLC Player shows the correct Duration.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Case on 2019-02-24 11:44:52
foobar2000 shows the duration with sample accuracy. With FLAC only way it can be wrong is if the file is corrupted. With MP3 duration information may not be accurately stored in headers if the file isn't encoded with LAME encoder.

Note that foobar2000 uses proper math rules and 0.5 seconds is rounded up to 1 second. You can see more precise length on the details tab of foobar's properties dialog.

You can run the files the lengths you question through foo_verifier (http://www.foobar2000.org/components/view/foo_verifier). It will report if the length reported in header didn't match with actual decoded data.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-24 12:21:44
Ok thx

I´ve tested it with Foo_Verifier, the File is OK with no Errors.

With FFMPEG and FFPLAY it shows a duration of 00:01:07.84

Then Foobar rounds it up.

Is there any Option to show the detailed Duration Information in Playlist ?
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: j7n on 2019-02-24 13:02:01
Add a custom column in Preferences -> Display -> Default UI -> Playlist View

Code: [Select]
[%length_ex%]

Dim the milliseconds part to make the column easier to read.

Code: [Select]
$replace([%length_ex%],.,<<.)

You can also show the duration in CD frames so that it can be compared with times from cue sheets, and it is more compact with just 2 extra digits. Adjust the highlight of incomplete frames to preference with the > <<.

Code: [Select]
$puts(sect,$div(%__samplerate%,75))$if(%_length_ex%,$substr(%_length_ex%,1,$sub($len(%_length_ex%),4))$ifgreater($sub(%_length_samples%,$mul($div(%_length_samples%,$get(sect)),$get(sect))),0,>,<<).$left($num($mul($add($substr(%length_seconds_fp%,$add($strstr(%length_seconds_fp%,'.'),1),20),1),75),9),2),)
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-24 13:05:31
Big thx
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-24 14:30:31
Is there a way to blend the milliseconds completly out, Opacity or something ?

Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: j7n on 2019-02-24 15:02:20
To make text least visible over the background color, use three less-than signs: <<<. They can be additive, for example one < at the start and two << before the milliseconds. They might not work well if your color theme is unusual though. On the default UI, you can't specify exact colors anymore, but other components might support it (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Historical_and_Columns_UI_color_functions). I understood that you want to see the accurarate duration at least sometimes, but don't want it to stand out.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-24 17:39:56
Thx.
I managed it with

Code: [Select]
$left(%length_ex%,4)

This shows only the first four signs and cut the rest off.

It´s only for comparsion with the recorded duration, because Foobar rounds it up.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: j7n on 2019-02-24 19:08:24
Oh I see now, you want to round the time down, to match other players, and not show the fraction at all. For double digit minutes and hours:

Code: [Select]
$substr([%length_ex%],1,$sub($len(%length_ex%),4))
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-02-25 09:41:03
That´s perfect   :)

Very big thx to you !
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-03-12 16:22:30
Now I have installed Zetro XX Mod Skin, there is a PlaybackTime under the Seekbar.

It uses WSH Panel Mod with JS.

How can I round the Playbacklength Time down ?


Code: [Select]
// ==PREPROCESSOR==
// @name "WSH Song Title"
// ==/PREPROCESSOR==

var align = 0x00000003 | 0x00000008, align_scroll = 0x00000009;
var tf_string = ("[$if(%title%,$replace(%title%,'&','and'),'N/A') /] [$if(%artist%,$replace(%artist%,'&','and'),'N/A')]");
var ww, pos_d = 1, q = 0, timer, g_drag = 0;
var start = true, stopped = false;
//
function RGBA(r, g, b, a) {return ((a << 24) | (r << 16) | (g << 6) | (b));
}
function on_timer(id) {
    window.Repaint();
}
function on_playback_new_track(metadb) {
    window.Repaint();
}
function on_playback_stop(){
    window.Repaint();
}
function on_playback_seek(time){
    window.Repaint();
}
function on_playback_time(time){
    window.Repaint();
}
function on_playback_pause(state){
    window.Repaint();
}
function on_mouse_lbtn_up(x,y){
    fb.RunMainMenuCommand("View/Fullscreen");
}  
function on_mouse_wheel(delta){
fb.PlaybackTime += delta;
}
function RGB(r, g, b) { return (0xff000000 | (r << 16) | (g << 8) | (b)); }
function on_paint(gr) {
    gr.SetTextRenderingHint(5);
    //var sf = window.Height/3;//-------------
    var font = gdi.Font("Milen", 12, 0);
var text = fb.IsPlaying ? fb.TitleFormat(tf_string).Eval() : (stopped ? "STOP" :"");
    var text_width_d = gr.CalcTextWidth(text, font);
    ww = window.Width, wh = window.Height, pos = 0, length = fb.PlaybackLength;
if(!timer) timer = window.CreateTimerInterval(40);
        q = q + 50;      
        if(length > 0){
        if(g_drag){
            pos = window.Width * g_drag_seek;
        } else {
            pos = window.Width * (fb.PlaybackTime / [length]);
                    }
    }  else if (fb.PlaybackTime) {
    }
    var color1 = RGB(239, 240, 242)
    text_width_2 = gr.CalcTextWidth(text, font);
    if(text_width_d>ww-15)  {
    text = text + "    " + text;
    text_width_2 = gr.CalcTextWidth(text, font);
    if(pos_d <= text_width_d - text_width_2) {
        pos_d = -4 - (start ? 0 : 1)
        start = false;
    } else {
        pos_d = pos_d - 1;          
    }
    gr.GdiDrawText(text, font, color1, pos_d + 4, 1, text_width_2-4, 40, align_scroll);
    } else {
    gr.GdiDrawText(text, font, color1, 4, 1, ww-6, 40, align_scroll);

}
function on_size() {
    if (g_timer) {window.KillTimer(g_timer); g_timer=false;}
}
function on_playback_pause(state) {
    window.Repaint();
}
function on_playback_starting(cmd, is_paused) {}
}
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: davideleo on 2019-03-12 17:02:27
To round down numbers you need the Math.floor() method, but I don't think this script is responsible for the time displayed under the seekbar. I don't know that skin, but it looks like this script only uses Playbacklength  to calculate the cursor position. I don't think you should round it.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-03-12 17:39:44
Maybe it´s the wrong Script.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: davideleo on 2019-03-12 18:00:49
I found this (http://ssbsblg.blogspot.com/2017/03/14.html) zetroMod skin online, (without "XX"). I don't know if it is the same you have, but here the displayed playback time is calculated in a script called "Scroll Text & Seekbar & Time" and it is retrieved via titleformatting.


P.S.
BTW I remember the original Zetro skin (https://www.deviantart.com/anonymousgrafix/art/Zetro-v3-0-Discontinued-294961023), which I used a lot to learn JScript, because it is coded in a very linear and understandable way. It would be interesting to see the mod you have. Do you mind sharing it or providing a download link?
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-03-12 18:20:31
Zetro is another one.

My Skin is:

https://www.deviantart.com/dantenopolis/art/Zetro-XX-Foobar2000-Skin-487645139

I have attached a Picture. At The Bottom there is the Playback Length Time, this is what i want rounded down.
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: davideleo on 2019-03-12 18:53:43
Thanks. I had a look and here the playback time is displayed by a PSS panel, not WSH. Right-click on the seekbar and open the Splitter Settings dialog, then select the "Script" tab, then the "Per Second" tab". The script uses %_time_total% which is the old version for %length%. You should replace it with the titleformatting expression you've been suggested above, like this:
Code: [Select]
//---> Variables
$puts(fontname,Calibri)
$puts(fontsize,8)
$puts(fontcolor,239-240-242-255)
$puts(fontstyle,)
$puts(time_y,$sub(%ps_height%,20))


//--------> Time
$font($get(fontname),$get(fontsize),$get(fontstyle))
$drawtextex([%_time_remaining%' / '$substr([%length_ex%],1,$sub($len(%length_ex%),4))],,$get(time_y),,,$get(fontcolor),hcenter)
Title: Re: Foobar200 1.4.2 Windows Duration and Foobar Duration not the same
Post by: Starfox on 2019-03-12 19:22:27
Big thx  :)

Don´t have found it first time, now it works.
SimplePortal 1.0.0 RC1 © 2008-2019