forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PMP Mod v2.02 & PMP Mod AVC v1.02
Goto page Previous  1, 2, 3 ... 50, 51, 52 ... 60, 61, 62  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Mon Jun 26, 2006 6:23 pm    Post subject: Reply with quote

@digihoe:

it's interesting, i need to verify if an eventual inclusion is technically possible



@mystic_memories:

the part that should write the informations is located in muxers.c (search for "jonny 2006-06-09", after patching)
i don't have idea of why the file is empty (maybe under linux a slightly different execution path is taken)
any suggestion is welcome (i'm not able to check in a linux box atm)

anyway, the howto specify width/height/fps manually (so, you don't need this file)



@mmick:

the sentence Raphael quoted is quite offensive.
personally, i don't need the type of feedback you can offer.
if you think you have something additional to say to me or Raphael, use PMs.
Back to top
View user's profile Send private message Visit poster's website
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Mon Jun 26, 2006 7:09 pm    Post subject: Reply with quote

mystic_memories, jonny's patch works for avi/avs input only, hence you get an empty text file. I'll post a patch tonight.
Back to top
View user's profile Send private message Visit poster's website
ils



Joined: 12 Apr 2005
Posts: 6

PostPosted: Mon Jun 26, 2006 7:40 pm    Post subject: Reply with quote

@jonny : thanks!! this app rocks!!

and is there "Goto" function ?? (sorry, didn't read the entire thread)
cos fast forward in 2 hours movie isn't that nice..

Thanks!
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Jun 26, 2006 8:56 pm    Post subject: Reply with quote

digihoe wrote:
jonny, do you see any possibilities to use hardware MP3 decoding (as mention here: http://forums.ps2dev.org/viewtopic.php?t=6020&sid=52f999830d60f8f410289ec0d8922883 ) in the future in combination with AVC in a PMP container?

Best regards!


First, more reverse in the vsh music_plugin is needed :)

Some more modules need to be loaded, i don't know yet which ones, but it won't difficult to find. (this also means that it won't be possible to be used in 2.01+)
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Mon Jun 26, 2006 9:33 pm    Post subject: Reply with quote

@ils:

not in the near future.
anyway, if your problem is mainly seek speed, pressing X while you seek will make everything a lot faster (probably in 5 seconds you can navigate an entire 2h movie)

@moonlight:

supposing it's possible, that would go probably only on the avc version (so only 1.5 anyway :)
Back to top
View user's profile Send private message Visit poster's website
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Mon Jun 26, 2006 9:50 pm    Post subject: Reply with quote

Oh? Cool, looking forward to it. Thanks!

606u wrote:
mystic_memories, jonny's patch works for avi/avs input only, hence you get an empty text file. I'll post a patch tonight.
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Tue Jun 27, 2006 12:19 am    Post subject: Reply with quote

moonlight wrote:

Some more modules need to be loaded, i don't know yet which ones, but it won't difficult to find. (this also means that it won't be possible to be used in 2.01+)


Hehe, you might think it should be that 2.01+ is slowly catching up to 1.5 with all the new stuff Sony put in, but actually it's the other way :) Using 1.5 gets more and more advantages with time.
Great job there by you guys :)
Back to top
View user's profile Send private message Visit poster's website
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Tue Jun 27, 2006 12:58 am    Post subject: Reply with quote

The following patch will fill .264.txt file when using yuv4mpeg input. I'm not completely sure if that is the correct code (as original one uses some values from AVI header). Insert this fragment at muxers.c:240
Code:
    if (info_filename_handle != 0)
      {
        fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 (int) 1000, (int) ((p_param->i_fps_num * 100.0) /
                                    p_param->i_fps_den + 0.9) * 10);
        fclose (info_filename_handle);
        info_filename_handle = 0;
      }

The final code should looks like:
Code:
    fprintf(stderr, "yuv4mpeg: %ix%i@%i/%ifps, %i:%i\n",
            h->width, h->height, p_param->i_fps_num, p_param->i_fps_den,
            p_param->vui.i_sar_width, p_param->vui.i_sar_height);

    if (info_filename_handle != 0)
      {
        fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 (int) 1000, (int) ((p_param->i_fps_num * 100.0) /
                                    p_param->i_fps_den + 0.9) * 10);
        fclose (info_filename_handle);
        info_filename_handle = 0;
      }

    *p_handle = (hnd_t)h;
    return 0;
}

Edit: Fixed few bits.


Last edited by 606u on Tue Jun 27, 2006 1:46 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
yoshaw



Joined: 05 Jan 2006
Posts: 30

PostPosted: Tue Jun 27, 2006 1:18 am    Post subject: Reply with quote

optimus wrote:
Simply update the PSP plug-in will make it work. Get it here and put the dev_psp.dll in MediaCoder's plugins folder.


Thanks. I just encoded the new 15min MGS4 trailer at 1200kbps(136MB) and it totally rocks the socks off of anything I've previously seen on PSP. ZOMG, Thanks to jonny for the AVC improvements! The framerate didn't stutter for a millisecond :)

PS: Is there anyway to findout/calculate the finished size(in megabytes) of the file being encoded into AVC? That would certainly help a lot of us with only 1GB memsticks!

Checkout the MGS4 trailers Raiden Fight on your PSP :)
http://www.savefile.com/files/4805248

:)
Back to top
View user's profile Send private message
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Tue Jun 27, 2006 5:01 am    Post subject: Reply with quote

Thanks for the code, it looks good (at rendering time).. I'll try it out tonight after it's finished rendering. (slow PC...)

606u wrote:
The following patch will fill .264.txt file when using yuv4mpeg input. I'm not completely sure if that is the correct code (as original one uses some values from AVI header). Insert this fragment at muxers.c:240
Code:
    if (info_filename_handle != 0)
      {
        fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 (int) 1000, (int) ((p_param->i_fps_num * 100.0) /
                                    p_param->i_fps_den + 0.9) * 10);
        fclose (info_filename_handle);
        info_filename_handle = 0;
      }

The final code should looks like:
Code:
    fprintf(stderr, "yuv4mpeg: %ix%i@%i/%ifps, %i:%i\n",
            h->width, h->height, p_param->i_fps_num, p_param->i_fps_den,
            p_param->vui.i_sar_width, p_param->vui.i_sar_height);

    if (info_filename_handle != 0)
      {
        fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 (int) 1000, (int) ((p_param->i_fps_num * 100.0) /
                                    p_param->i_fps_den + 0.9) * 10);
        fclose (info_filename_handle);
        info_filename_handle = 0;
      }

    *p_handle = (hnd_t)h;
    return 0;
}

Edit: Fixed few bits.
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Tue Jun 27, 2006 6:15 am    Post subject: Reply with quote

thanks 606u
a little semplification:

Code:

        fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 p_param->i_fps_den, p_param->i_fps_num);


it's better to keep the values intact (in some particular cases your prev code could generate av desync due to some precision lost)
now you can skip -w -h -s -r :)
Back to top
View user's profile Send private message Visit poster's website
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Tue Jun 27, 2006 7:38 am    Post subject: Reply with quote

Thanks, jonny. Here is a new version of Linux convertion script that will try to preserve the aspect ratio of AVI-files when downscaling:
Code:
#!/bin/sh

die ()
{
    echo "$1"
    exit 1
}

[ -n "$1" -a -n "$2" ] || die "Usage: $0 in.avi out"
[ ! -f "$1" ] && die "$1: not found"
[ -f "$2.264" ] && die "$2.264: already exists"
[ -f "$2.mp3" ] && die "$2.mp3: already exists"
[ -f "$2.pmp" ] && die "$2.pmp: already exists"

multiple_of_16 ()
{ # scale value to multiple of 16; 1: value, 2: max
    low=`expr $1 - \( $1 % 16 \)`
    high=`expr $low + 16`
    if [ $high -le $2 ] ; then
        low_diff=`expr $1 - $low`
        high_diff=`expr $high - $1`
        if [ $low_diff -le $high_diff ] ; then
            echo $low
        else
            echo $high
        fi
    else
        echo $low
    fi
}

scale ()
{ # scale up to 480 x 272, output to WIDTH/HEIGHT; 1: width, 2: height
    width=$1
    height=$2
    scale=`expr $width \* 10000 / $height`
    if [ $scale -ge 17647 ] ; then # 480 / 272 = 1,7647
        WIDTH=480
        HEIGHT=`expr $WIDTH \* 10000 / $scale`
        HEIGHT=`multiple_of_16 $HEIGHT 272`
    else
        HEIGHT=272
        WIDTH=`expr $HEIGHT \* $scale / 10000`
        WIDTH=`multiple_of_16 $WIDTH 480`
    fi
}

WIDTH=480
HEIGHT=272

avi_info=`file -b "$1" | grep 'RIFF ' | grep ', AVI, '`
if [ -n "$avi_info" ] ; then
    # in.avi: RIFF (little-endian) data, AVI, 704 x 400, 23.98 fps, \
    #    video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
    check_2=`echo "$avi_info" | cut -d, -f2`
    if [ "$check_2" == " AVI" ] ; then
        width_x_height=`echo "$avi_info" | cut -d, -f3`
        width=`echo "$width_x_height" | cut -dx -f1`
        height=`echo "$width_x_height" | cut -dx -f2`
        scale $width $height
        echo "$width x $height => $WIDTH x $HEIGHT"
    fi
fi

H264CRF=24 # up to 51; 18 == XviD' Qf 2

PIPE=/tmp/pipe.y4m

rm -f $PIPE
mkfifo $PIPE || exit 1

mplayer -benchmark -nosound -quiet -really-quiet \
    -vo yuv4mpeg:file=$PIPE -vf scale=$WIDTH:$HEIGHT "$1" &
x264 --crf $H264CRF -A all --level 3 --pictiming --aud --no-psnr \
    --thread-input --output "$2.264" $PIPE

mencoder -quiet -really-quiet "$1" -srate 44100 -oac mp3lame \
    -lameopts vol=0:mode=0:cbr:br=112 -ovc copy -of rawaudio -o "$2.mp3"

pmp_muxer_avc -v "$2.264" -a "$2.mp3" -o "$2.pmp"

# remove temporary files
# rm -f "$2.264" "$2.264.txt" "$2.mp3" "$2.pmp.log"
Back to top
View user's profile Send private message Visit poster's website
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 2:47 am    Post subject: Reply with quote

I'm current using the following call to perform the encoding, and I'm experiencing some sync issues. It's not as bad with small flicks, but as the video gets bigger (~25mins), it goes to upwards of 43 seconds. From reading the thread, I have a feeling it could be solved by the "harddup" option in mplayer. But the harddup option only works with mencoder and not mplayer (according to the man pages). Anyone have any ideas how this can be fixed? Thanks!

Code:

mplayer -benchmark -nosound -quiet -really-quiet \
-vo yuv4mpeg:file=${PIPE} \
-fps ${RATE}/${SCALE} \
-vf ${CROP}scale=${TARGET_WIDTH}:${TARGET_HEIGHT},expand=::::::16,harddup \
"${infile}" &

x264 --crf ${H264CRF} -A all --level 3 --pictiming --aud --no-psnr \
    --thread-input --output "${infile}.264" ${PIPE}

mencoder -quiet -really-quiet "${infile}" -srate 44100 -oac mp3lame \
    -af channels=2,resample=44100:0:2 -lameopts vol=0:mode=0:cbr:br=128 \
    -ovc copy -of rawaudio -o "${infile}.mp3"

#uses the .txt file for input params.
pmp_muxer_avc.pl -v "${infile}.264" -a "${infile}.mp3" -o "${infile}.pm
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Thu Jun 29, 2006 3:51 am    Post subject: Reply with quote

you should try to verify:

1) length in seconds of ${infile}
2) length in seconds of ${infile}.264 (you can derive this using rate, scale and the number of frames found by the muxer)
3) length in seconds of ${infile}.mp3
4) also, if you have enough disk space, length in seconds of the raw yuv4 file (i don't have idea about how this can be derived)

you could also try to compile mencoder with the modified x264 (and use the command line suggested by cooleyes some pages ago)

it would be really strange if mplayer doesn't output duplicate frames also when the output is raw data (actually the need to use harddup to avoid "0 bytes frames" is probably something i'll never understand :)


EDIT: i assume you are also using this:

Code:

fprintf (info_filename_handle,
                 "width=%i\nheight=%i\nscale=%i\nrate=%i",
                 p_param->i_width, p_param->i_height,
                 p_param->i_fps_den, p_param->i_fps_num);
Back to top
View user's profile Send private message Visit poster's website
Eingang



Joined: 04 Jan 2006
Posts: 59

PostPosted: Thu Jun 29, 2006 6:54 am    Post subject: Reply with quote

JONNY !

Thank you so much for your x264 vfw binary + installer ------
this opens up comfortable avc encoding to most of us.....

it seems there wonīt be any need to develop old mod any further....
you can really be proud jonny for your work itīs amazing
of course all others helping too !!!!
Back to top
View user's profile Send private message
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 10:34 am    Post subject: Reply with quote

@jonny

Thanks for the tip. My findings are as follows:
1) Original Video (min:sec): 46:46
2) Extracted MP3: 46:46
3) {infile}.264: Going from the 55795 which I think is the number of frames. I get 46:30 which is about 16 seconds difference there. A snipplet of the output from the muxer is as follows:

Code:

05.rmvb.264:
Processing video ...
05.rmvb.264.txt found
width: 368
height: 272
scale: 1
rate: 20
55795


05.rmvb.mp3:
Processing audio ...
107427
resync_count = 0
unused_bytes = 0 / 44900101
first frame at 0


Really seems like mplayer is trying to be smart and skipping some frames. Can't find any useful flags to set to force it to output all frames either. Short of patching mplayer, does anyone have any other ideas how this can be solved?
Back to top
View user's profile Send private message
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 11:19 am    Post subject: Reply with quote

@cooleyes

Did you actually have to modify the mencoder source or did you simply use the patched x264 and recompiled the mencoder?
Back to top
View user's profile Send private message
cooleyes



Joined: 18 May 2006
Posts: 125

PostPosted: Thu Jun 29, 2006 11:23 am    Post subject: Reply with quote

mystic_memories wrote:
@cooleyes

Did you actually have to modify the mencoder source or did you simply use the patched x264 and recompiled the mencoder?


patched x264 and modify mencoder
Back to top
View user's profile Send private message
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 2:01 pm    Post subject: Reply with quote

@ cooleyes

Could you possibly post the diff for the changes you made to mencoder and/or x264? Seems like mencoder is the only way to get it working properly on Linux. Your help would be greatly appreciated. Thanks.
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Thu Jun 29, 2006 5:14 pm    Post subject: Reply with quote

strange, i had no need to modify mencoder (but i've tested it quickly, maybe i'm missing something)
Back to top
View user's profile Send private message Visit poster's website
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Thu Jun 29, 2006 8:55 pm    Post subject: Reply with quote

mystic_memories, have you tried with no -fps ${RATE}/${SCALE} option? In your pmp avc muxer output you've scale: 1, rate: 20 which is exactly 20 fps. Maybe there are rounding problems...? Doesn't it work fine if you do not specify frames-per-second explicitly?
Back to top
View user's profile Send private message Visit poster's website
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 9:29 pm    Post subject: Reply with quote

606u wrote:
mystic_memories, have you tried with no -fps ${RATE}/${SCALE} option? In your pmp avc muxer output you've scale: 1, rate: 20 which is exactly 20 fps. Maybe there are rounding problems...? Doesn't it work fine if you do not specify frames-per-second explicitly?


The -fps is derived from the comments from mplayer. I've noticed that sometimes the rate and scale are not properly passed to x264 if it's not defined that way. But I've also tried encoding without the explicit -fps and it still produces the exact number of frames as stated before.
Back to top
View user's profile Send private message
mystic_memories



Joined: 12 Mar 2006
Posts: 12

PostPosted: Thu Jun 29, 2006 9:34 pm    Post subject: Reply with quote

I've tried encoding with encoder with the x264 function enabled, and it does provide me with the right number of frames. But I think I'm missing some important changes in mencoder/x264, since the resultant pmp file is not playable from the PSP... (invalid format error). I would be very interested to know what changes cooleyes made to make mencoder work for pmp. :)
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Thu Jun 29, 2006 10:01 pm    Post subject: Reply with quote

"pmp_file_open: invalid video format" ?

are you using this muxer:

http://jonny.leffe.dnsalias.com/pmp_mod_avc/rar/pmp_muxer_avc_1_01_source.rar

?
(i assume you are also passing to it an avi file)


EDIT:

i also assume you are using this player:
http://jonny.leffe.dnsalias.com/pmp_mod_avc/rar/pmp_mod_avc_1_02.rar

this x264 with both patches (magiK patch first):
http://jonny.leffe.dnsalias.com/pmp_mod_avc/rar/x264_2nd_source.rar

and a command line similar to:
mencoder -nosound -ovc x264 -x264encopts bitrate=512 -vf scale=480:272,harddup -o test.avi 1.avi
Back to top
View user's profile Send private message Visit poster's website
cooleyes



Joined: 18 May 2006
Posts: 125

PostPosted: Thu Jun 29, 2006 11:20 pm    Post subject: Reply with quote

@jonny:

can you add AAC support into pmp-avc?
I think AAC is better than mp3.
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Fri Jun 30, 2006 12:01 am    Post subject: Reply with quote

it's in my todo list, but have a low priority (compared to mp3, aac have a larger number of samples per frame / this gives some complications in the current player structure)
Back to top
View user's profile Send private message Visit poster's website
pegasus



Joined: 17 Jan 2006
Posts: 61

PostPosted: Fri Jun 30, 2006 12:20 am    Post subject: hello Reply with quote

hi cooleyes would you mind uploading your patched mencoder??

i get 10-15fps on x264 and its slow (1200mhz)

but in mencoder i can get as much as 40fps..

tnx if u dont mind..
Back to top
View user's profile Send private message
cooleyes



Joined: 18 May 2006
Posts: 125

PostPosted: Fri Jun 30, 2006 12:55 am    Post subject: Re: hello Reply with quote

pegasus wrote:
hi cooleyes would you mind uploading your patched mencoder??

i get 10-15fps on x264 and its slow (1200mhz)

but in mencoder i can get as much as 40fps..

tnx if u dont mind..


http://rapidshare.de/files/23885627/mencoder-x264patched.rar.html

for P3:
http://rapidshare.de/files/23955930/mencoder-x264patched-p3.rar.html

for P4:
http://rapidshare.de/files/23956385/mencoder-x264patched-p4.rar.html

for K7:
http://rapidshare.de/files/23956710/mencoder-x264patched-k7.rar.html
Back to top
View user's profile Send private message
cooleyes



Joined: 18 May 2006
Posts: 125

PostPosted: Fri Jun 30, 2006 1:01 am    Post subject: Reply with quote

jonny wrote:
it's in my todo list, but have a low priority (compared to mp3, aac have a larger number of samples per frame / this gives some complications in the current player structure)


I have made a player "CoolPlayer" , it is a music player, it can play APE, FLAC, WV.
FLAC also have large number of sample per frame, but it can play well in PSP.

so I think support AAC is easy, :P
Back to top
View user's profile Send private message
pegasus



Joined: 17 Jan 2006
Posts: 61

PostPosted: Fri Jun 30, 2006 1:04 am    Post subject: hello Reply with quote

tnx for the quick reply gotta test it and post again tnx!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3 ... 50, 51, 52 ... 60, 61, 62  Next
Page 51 of 62

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group