* [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 @ 2024-01-02 2:49 aybe aybe 2024-01-05 20:53 ` Michael Niedermayer ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: aybe aybe @ 2024-01-02 2:49 UTC (permalink / raw) To: ffmpeg-devel Hi, As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 What happens is that only the audio is present in the video file. Anyway, that one character patch fixes the problem, video is now rendered. Signed-off-by: aybe <aybe@users.noreply.github.com> --- libavcodec/mdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 44b12471a9..c4904216b8 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) const int qscale = a->qscale; /* DC coefficient */ - if (a->version == 2) { + if (a->version <= 2) { block[0] = 2 * get_sbits(&a->gb, 10) + 1024; } else { component = (n <= 3 ? 0 : n - 4 + 1); -- 2.41.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-02 2:49 [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 aybe aybe @ 2024-01-05 20:53 ` Michael Niedermayer 2024-01-06 12:31 ` aybe aybe 2024-01-10 2:37 ` Michael Niedermayer 2024-01-10 2:46 ` Michael Niedermayer 2 siblings, 1 reply; 14+ messages in thread From: Michael Niedermayer @ 2024-01-05 20:53 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 1648 bytes --] On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: > Hi, > > As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). > > Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: > [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 > > What happens is that only the audio is present in the video file. > > Anyway, that one character patch fixes the problem, video is now rendered. > > Signed-off-by: aybe <aybe@users.noreply.github.com> > --- > libavcodec/mdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c > index 44b12471a9..c4904216b8 100644 > --- a/libavcodec/mdec.c > +++ b/libavcodec/mdec.c > @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) > const int qscale = a->qscale; > > /* DC coefficient */ > - if (a->version == 2) { > + if (a->version <= 2) { > block[0] = 2 * get_sbits(&a->gb, 10) + 1024; > } else { > component = (n <= 3 ? 0 : n - 4 + 1); This seems not to apply automatically here Applying: avcodec/mdec: DC reading for STRv1 is like STRv2 Using index info to reconstruct a base tree... error: patch failed: libavcodec/mdec.c:68 error: libavcodec/mdec.c: patch does not apply error: Did you hand edit your patch? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-05 20:53 ` Michael Niedermayer @ 2024-01-06 12:31 ` aybe aybe 0 siblings, 0 replies; 14+ messages in thread From: aybe aybe @ 2024-01-06 12:31 UTC (permalink / raw) To: ffmpeg-devel Yes, I can see the warnings in patchwork but I don't understand what's the actual problem. This is how I've done things over here: - forked https://github.com/FFmpeg/FFmpeg which is synchronized with https://git.ffmpeg.org/ffmpeg.git - made the changes, committed them - created the patches with 'git format patch' instructions in https://ffmpeg.org/developer.html#Submitting-patches-1 - posted the .eml files without any editing (as the log is mentioning in patchwork) Right now I just synced my fork and it merged new changes since then with no issues (https://github.com/aybe/FFmpeg/commits/master/). So I don't know what's going on, maybe someone can shed some light on it? ------ Original Message ------ From "michael at niedermayer.cc" <nobody@invalid.invalid> To Date 1/5/2024 9:53:52 PM Subject [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 >On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: >> Hi, >> >> As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). >> >> Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: >> [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 >> >> What happens is that only the audio is present in the video file. >> >> Anyway, that one character patch fixes the problem, video is now rendered. >> >> Signed-off-by: aybe <aybe at users.noreply.github.com> >> --- >> libavcodec/mdec.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c >> index 44b12471a9..c4904216b8 100644 >> --- a/libavcodec/mdec.c >> +++ b/libavcodec/mdec.c >> @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) >> const int qscale = a->qscale; >> >> /* DC coefficient */ >> - if (a->version == 2) { >> + if (a->version <= 2) { >> block[0] = 2 * get_sbits(&a->gb, 10) + 1024; >> } else { >> component = (n <= 3 ? 0 : n - 4 + 1); > >This seems not to apply automatically here > >Applying: avcodec/mdec: DC reading for STRv1 is like STRv2 >Using index info to reconstruct a base tree... >error: patch failed: libavcodec/mdec.c:68 >error: libavcodec/mdec.c: patch does not apply >error: Did you hand edit your patch? > >[...] >-- >Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > >Asymptotically faster algorithms should always be preferred if you have >asymptotical amounts of data >-------------- next part -------------- >A non-text attachment was scrubbed... >Name: signature.asc >Type: application/pgp-signature >Size: 195 bytes >Desc: not available >URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240105/fc813de7/attachment.sig> > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-02 2:49 [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 aybe aybe 2024-01-05 20:53 ` Michael Niedermayer @ 2024-01-10 2:37 ` Michael Niedermayer 2024-01-13 2:32 ` aybe aybe 2024-01-10 2:46 ` Michael Niedermayer 2 siblings, 1 reply; 14+ messages in thread From: Michael Niedermayer @ 2024-01-10 2:37 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 2063 bytes --] On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: > Hi, > > As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). > > Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: > [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 > > What happens is that only the audio is present in the video file. > > Anyway, that one character patch fixes the problem, video is now rendered. > > Signed-off-by: aybe <aybe@users.noreply.github.com> > --- > libavcodec/mdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c > index 44b12471a9..c4904216b8 100644 > --- a/libavcodec/mdec.c > +++ b/libavcodec/mdec.c > @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) > const int qscale = a->qscale; > > /* DC coefficient */ > - if (a->version == 2) { > + if (a->version <= 2) { > block[0] = 2 * get_sbits(&a->gb, 10) + 1024; > } else { > component = (n <= 3 ? 0 : n - 4 + 1); > -- > 2.41.0.windows.1 This is how the patch should look: (there are differencs in the whitespace which git seems to have problems with in above) not sure where these differences came from thx diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 44b12471a9e..c4904216b81 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) const int qscale = a->qscale; /* DC coefficient */ - if (a->version == 2) { + if (a->version <= 2) { block[0] = 2 * get_sbits(&a->gb, 10) + 1024; } else { component = (n <= 3 ? 0 : n - 4 + 1); [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-10 2:37 ` Michael Niedermayer @ 2024-01-13 2:32 ` aybe aybe 0 siblings, 0 replies; 14+ messages in thread From: aybe aybe @ 2024-01-13 2:32 UTC (permalink / raw) To: FFmpeg development discussions and patches I'm afraid I can't tell, I checked the commits before creating patches out of them; they did not appear to have superfluous whitespace in them. ------ Original Message ------ From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/10/2024 3:37:41 AM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: Hi, As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 What happens is that only the audio is present in the video file. Anyway, that one character patch fixes the problem, video is now rendered. Signed-off-by: aybe <aybe@users.noreply.github.com<mailto:aybe@users.noreply.github.com>> --- libavcodec/mdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 44b12471a9..c4904216b8 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) const int qscale = a->qscale; /* DC coefficient */ - if (a->version == 2) { + if (a->version <= 2) { block[0] = 2 * get_sbits(&a->gb, 10) + 1024; } else { component = (n <= 3 ? 0 : n - 4 + 1); -- 2.41.0.windows.1 This is how the patch should look: (there are differencs in the whitespace which git seems to have problems with in above) not sure where these differences came from thx diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 44b12471a9e..c4904216b81 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) const int qscale = a->qscale; /* DC coefficient */ - if (a->version == 2) { + if (a->version <= 2) { block[0] = 2 * get_sbits(&a->gb, 10) + 1024; } else { component = (n <= 3 ? 0 : n - 4 + 1); [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-02 2:49 [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 aybe aybe 2024-01-05 20:53 ` Michael Niedermayer 2024-01-10 2:37 ` Michael Niedermayer @ 2024-01-10 2:46 ` Michael Niedermayer 2024-01-13 2:28 ` aybe aybe 2 siblings, 1 reply; 14+ messages in thread From: Michael Niedermayer @ 2024-01-10 2:46 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 656 bytes --] On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: > Hi, > > As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). > > Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: > [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 where can i find a psxstr file to test this ? the psxstr files i find on https://samples.ffmpeg.org/ seem not affected by this thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-10 2:46 ` Michael Niedermayer @ 2024-01-13 2:28 ` aybe aybe 2024-01-14 20:38 ` Michael Niedermayer via ffmpeg-devel 0 siblings, 1 reply; 14+ messages in thread From: aybe aybe @ 2024-01-13 2:28 UTC (permalink / raw) To: FFmpeg development discussions and patches Here are the two STR files I have used when writing this patch: https://github.com/aybe/FFmpeg-PSX-STR-tests Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 29.97)... However, as the reversed-engineered docs in jpsxdec mentions, it is sort of impossible to figure out which value to snap to from how frames spans across CD-ROM sectors. The sector count per video frame always seem to juggle between two values, e.g. 6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant. Also, as one can see in the various code samples online on writing a PSX program that plays MDEC videos, it is the responsibility of the coder to present the frames on screen. i.e. there is not definitive way on how to do so, and even if there was, you can be sure some folks did not play by the rules back then. The only way to figure out how a movie was intended to be played is to reverse engineer a game to see what values they did cram in. In short, the computed frame rate is 99% good, not 100%. But for mere mortals, they are unlikely to notice it at all. As for the movies in the samples repository, they are corrupt and FFmpeg fails at them, obviously. I figured these ones were by checking them in a hex-editor but also by loading them in https://github.com/m35/jpsxdec<https://> which has great logging. Not sure why these samples were corrupt in first instance, maybe it was intentional for testing? I can't tell. ------ Original Message ------ From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/10/2024 3:46:02 AM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 On Tue, Jan 02, 2024 at 02:49:26AM +0000, aybe aybe wrote: Hi, As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems). Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1: [mdec @ 00000000027c72c0] ac-tex damaged at 1 9 where can i find a psxstr file to test this ? the psxstr files i find on https://samples.ffmpeg.org/ seem not affected by this thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-13 2:28 ` aybe aybe @ 2024-01-14 20:38 ` Michael Niedermayer via ffmpeg-devel 2024-01-15 16:14 ` aybe aybe 0 siblings, 1 reply; 14+ messages in thread From: Michael Niedermayer via ffmpeg-devel @ 2024-01-14 20:38 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: Michael Niedermayer [-- Attachment #1.1: Type: text/plain, Size: 2838 bytes --] Hi aybe On Sat, Jan 13, 2024 at 02:28:52AM +0000, aybe aybe wrote: > Here are the two STR files I have used when writing this patch: https://github.com/aybe/FFmpeg-PSX-STR-tests ok, i can confirm the version patch fixes these, i will apply it > Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 29.97)... > However, as the reversed-engineered docs in jpsxdec mentions, it is sort of impossible to figure out which value to snap to from how frames spans across CD-ROM sectors. > The sector count per video frame always seem to juggle between two values, e.g. 6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant. > > Also, as one can see in the various code samples online on writing a PSX program that plays MDEC videos, it is the responsibility of the coder to present the frames on screen. > i.e. there is not definitive way on how to do so, and even if there was, you can be sure some folks did not play by the rules back then. > The only way to figure out how a movie was intended to be played is to reverse engineer a game to see what values they did cram in. > In short, the computed frame rate is 99% good, not 100%. But for mere mortals, they are unlikely to notice it at all. Well, with the subset of samples i have, i dont feel confident that i could write and test timestamping/fps. The docuemnt you linked says "Data is read from the disc one sector at a time at either 75 sectors per second (single speed) or 150 sectors per second (double speed). The video and audio are spaced out over these sectors so they can be delivered at the appropriate times." what i would suggest to try is: avpriv_set_pts_info(st, 64, 1, 150); (or 75 for single speed) and then set AVPacket->pts to the sector number you never set fps, leave it to libavformat to figure it out. can you try that ? (i assume you have many samples to easily check) > > As for the movies in the samples repository, they are corrupt and FFmpeg fails at them, obviously. > I figured these ones were by checking them in a hex-editor but also by loading them in https://github.com/m35/jpsxdec<https://> which has great logging. > Not sure why these samples were corrupt in first instance, maybe it was intentional for testing? I can't tell. Thats very strange, anyone remembers where these samples are from originally ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-14 20:38 ` Michael Niedermayer via ffmpeg-devel @ 2024-01-15 16:14 ` aybe aybe 2024-01-15 23:42 ` Michael Niedermayer 0 siblings, 1 reply; 14+ messages in thread From: aybe aybe @ 2024-01-15 16:14 UTC (permalink / raw) To: FFmpeg development discussions and patches Hi! I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. The results are somewhat mixed: - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC Not sure about 150, we assume videos play at 2x CD-ROM, not 100% exact but is likely to be the case for 99% of them. ------ Original Message ------ From "Michael Niedermayer via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Cc "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc>> Date 1/14/2024 9:38:06 PM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 Hi aybe On Sat, Jan 13, 2024 at 02:28:52AM +0000, aybe aybe wrote: Here are the two STR files I have used when writing this patch: https://github.com/aybe/FFmpeg-PSX-STR-tests ok, i can confirm the version patch fixes these, i will apply it Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 29.97)... However, as the reversed-engineered docs in jpsxdec mentions, it is sort of impossible to figure out which value to snap to from how frames spans across CD-ROM sectors. The sector count per video frame always seem to juggle between two values, e.g. 6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant. Also, as one can see in the various code samples online on writing a PSX program that plays MDEC videos, it is the responsibility of the coder to present the frames on screen. i.e. there is not definitive way on how to do so, and even if there was, you can be sure some folks did not play by the rules back then. The only way to figure out how a movie was intended to be played is to reverse engineer a game to see what values they did cram in. In short, the computed frame rate is 99% good, not 100%. But for mere mortals, they are unlikely to notice it at all. Well, with the subset of samples i have, i dont feel confident that i could write and test timestamping/fps. The docuemnt you linked says "Data is read from the disc one sector at a time at either 75 sectors per second (single speed) or 150 sectors per second (double speed). The video and audio are spaced out over these sectors so they can be delivered at the appropriate times." what i would suggest to try is: avpriv_set_pts_info(st, 64, 1, 150); (or 75 for single speed) and then set AVPacket->pts to the sector number you never set fps, leave it to libavformat to figure it out. can you try that ? (i assume you have many samples to easily check) As for the movies in the samples repository, they are corrupt and FFmpeg fails at them, obviously. I figured these ones were by checking them in a hex-editor but also by loading them in https://github.com/m35/jpsxdec<https://> which has great logging. Not sure why these samples were corrupt in first instance, maybe it was intentional for testing? I can't tell. Thats very strange, anyone remembers where these samples are from originally ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-15 16:14 ` aybe aybe @ 2024-01-15 23:42 ` Michael Niedermayer 2024-01-16 14:27 ` aybe aybe 0 siblings, 1 reply; 14+ messages in thread From: Michael Niedermayer @ 2024-01-15 23:42 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 652 bytes --] On Mon, Jan 15, 2024 at 04:14:46PM +0000, aybe aybe wrote: > Hi! > > I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. > > The results are somewhat mixed: > - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC > - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC can you send the patch for this plus links to one sample for both cases ? id like to take a look thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-15 23:42 ` Michael Niedermayer @ 2024-01-16 14:27 ` aybe aybe 2024-01-16 14:32 ` aybe aybe [not found] ` <emd5d779f2-9283-4be7-82e5-afaf16ca635e@a51bcb19.com> 0 siblings, 2 replies; 14+ messages in thread From: aybe aybe @ 2024-01-16 14:27 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1: Type: text/plain, Size: 1760 bytes --] The new patch appears to work, stuff is synchronized, except: - 30 FPS video still seen as 150FPS by VLC - 15 FPS video emits tons of "[vost#0:0/rawvideo @ 000000000269b580] Clipping frame in rate conversion by 0.199989" As for the corrupt samples, been able to find the original sources: - the first is good old Descent - was cut at exactly 2MB - works in FFmpeg - the second is Ridge Racer Type 4 - bad/incomplete extract with a tool that added "RIFF....CDXA" header for whatever reason - does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams (only decodes some audio then aborts) - but if I extract the relevant section from it, then works in FFmpeg New videos, samples, logs: https://github.com/aybe/FFmpeg-PSX-STR-tests ------ Original Message ------ From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 12:42:49 AM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 On Mon, Jan 15, 2024 at 04:14:46PM +0000, aybe aybe wrote: Hi! I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. The results are somewhat mixed: - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC can you send the patch for this plus links to one sample for both cases ? id like to take a look thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates [-- Attachment #2: 0001-avformat-psxstr-infer-video-FPS-using-sector-LBA.eml.url --] [-- Type: application/octet-stream, Size: 134 bytes --] [-- Attachment #3: 0002-avformat-psxstr-update-fate-checksums.eml.url --] [-- Type: application/octet-stream, Size: 123 bytes --] [-- Attachment #4: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-16 14:27 ` aybe aybe @ 2024-01-16 14:32 ` aybe aybe [not found] ` <emd5d779f2-9283-4be7-82e5-afaf16ca635e@a51bcb19.com> 1 sibling, 0 replies; 14+ messages in thread From: aybe aybe @ 2024-01-16 14:32 UTC (permalink / raw) To: FFmpeg development discussions and patches Modern email clients like to do stuff they're told not to... The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests ------ Original Message ------ From "aybe aybe" <aybe.one-at-hotmail.com@ffmpeg.org<mailto:aybe.one-at-hotmail.com@ffmpeg.org>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 3:27:16 PM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 The new patch appears to work, stuff is synchronized, except: - 30 FPS video still seen as 150FPS by VLC - 15 FPS video emits tons of "[vost#0:0/rawvideo @ 000000000269b580] Clipping frame in rate conversion by 0.199989" As for the corrupt samples, been able to find the original sources: - the first is good old Descent - was cut at exactly 2MB - works in FFmpeg - the second is Ridge Racer Type 4 - bad/incomplete extract with a tool that added "RIFF....CDXA" header for whatever reason - does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams (only decodes some audio then aborts) - but if I extract the relevant section from it, then works in FFmpeg New videos, samples, logs: https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faybe%2FFFmpeg-PSX-STR-tests&data=05%7C02%7C%7Cc7debed92bce42a5bcd908dc169f43bd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638410120640174537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2Faq1Hcn5X%2FVCvtVi5GO6Jes7mrPUCeZyrIZvDiAj6lw%3D&reserved=0 ------ Original Message ------ From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc><mailto:michael@niedermayer.cc>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 12:42:49 AM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 On Mon, Jan 15, 2024 at 04:14:46PM +0000, aybe aybe wrote: Hi! I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. The results are somewhat mixed: - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC can you send the patch for this plus links to one sample for both cases ? id like to take a look thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <emd5d779f2-9283-4be7-82e5-afaf16ca635e@a51bcb19.com>]
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 [not found] ` <emd5d779f2-9283-4be7-82e5-afaf16ca635e@a51bcb19.com> @ 2024-01-16 14:39 ` aybe aybe 2024-01-16 14:56 ` aybe aybe 0 siblings, 1 reply; 14+ messages in thread From: aybe aybe @ 2024-01-16 14:39 UTC (permalink / raw) To: FFmpeg development discussions and patches Lol, I told you I was struggling with emClient, it decided to send .eml as .url... Here are the patches, hopefully! [FFmpeg-devel] [PATCH 1/2] avformat/psxstr: infer video FPS using sector LBA https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319701.html [FFmpeg-devel] [PATCH 2/2] avformat/psxstr: update fate checksums https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319702.html ------ Original Message ------ From "aybe" <aybe.one@hotmail.com<mailto:aybe.one@hotmail.com>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 3:32:36 PM Subject Re[2]: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 Modern email clients like to do stuff they're told not to... The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests ------ Original Message ------ From "aybe aybe" <aybe.one-at-hotmail.com@ffmpeg.org<mailto:aybe.one-at-hotmail.com@ffmpeg.org>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 3:27:16 PM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 The new patch appears to work, stuff is synchronized, except: - 30 FPS video still seen as 150FPS by VLC - 15 FPS video emits tons of "[vost#0:0/rawvideo @ 000000000269b580] Clipping frame in rate conversion by 0.199989" As for the corrupt samples, been able to find the original sources: - the first is good old Descent - was cut at exactly 2MB - works in FFmpeg - the second is Ridge Racer Type 4 - bad/incomplete extract with a tool that added "RIFF....CDXA" header for whatever reason - does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams (only decodes some audio then aborts) - but if I extract the relevant section from it, then works in FFmpeg New videos, samples, logs: https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faybe%2FFFmpeg-PSX-STR-tests&data=05%7C02%7C%7Cc7debed92bce42a5bcd908dc169f43bd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638410120640174537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2Faq1Hcn5X%2FVCvtVi5GO6Jes7mrPUCeZyrIZvDiAj6lw%3D&reserved=0 ------ Original Message ------ From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc><mailto:michael@niedermayer.cc>> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>> Date 1/16/2024 12:42:49 AM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 On Mon, Jan 15, 2024 at 04:14:46PM +0000, aybe aybe wrote: Hi! I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. The results are somewhat mixed: - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC can you send the patch for this plus links to one sample for both cases ? id like to take a look thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 2024-01-16 14:39 ` aybe aybe @ 2024-01-16 14:56 ` aybe aybe 0 siblings, 0 replies; 14+ messages in thread From: aybe aybe @ 2024-01-16 14:56 UTC (permalink / raw) To: FFmpeg development discussions and patches These email issues made me forgot to tell an important thing... That new FPS patch is meant to be applied right after this: avformat/psxstr: fix unknown sector type 00/80 a96d556baaf7cb71babad96238eadb532d02f3a6 i.e. not over the previous FPS patch attempt: avformat/psxstr: basic FPS detection instead of fixed value 464243adac7abfa9b926a1faf6f59515661efa7f I think we're good now :) ------ Original Message ------ From "aybe aybe" <aybe.one-at-hotmail.com@ffmpeg.org> To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org> Date 1/16/2024 3:39:09 PM Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 >Lol, I told you I was struggling with emClient, it decided to send .eml as .url... > >Here are the patches, hopefully! > >[FFmpeg-devel] [PATCH 1/2] avformat/psxstr: infer video FPS using sector LBA >https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319701.html > >[FFmpeg-devel] [PATCH 2/2] avformat/psxstr: update fate checksums >https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319702.html > >------ Original Message ------ >From "aybe" <aybe.one@hotmail.com<mailto:aybe.one@hotmail.com>> >To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> >Date 1/16/2024 3:32:36 PM >Subject Re[2]: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 > >Modern email clients like to do stuff they're told not to... > >The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests > > >------ Original Message ------ >From "aybe aybe" <aybe.one-at-hotmail.com@ffmpeg.org<mailto:aybe.one-at-hotmail.com@ffmpeg.org>> >To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>> >Date 1/16/2024 3:27:16 PM >Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 > >The new patch appears to work, stuff is synchronized, except: >- 30 FPS video still seen as 150FPS by VLC >- 15 FPS video emits tons of "[vost#0:0/rawvideo @ 000000000269b580] Clipping frame in rate conversion by 0.199989" > >As for the corrupt samples, been able to find the original sources: > >- the first is good old Descent >- was cut at exactly 2MB >- works in FFmpeg >- the second is Ridge Racer Type 4 >- bad/incomplete extract with a tool that added "RIFF....CDXA" header for whatever reason >- does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams (only decodes some audio then aborts) >- but if I extract the relevant section from it, then works in FFmpeg > >New videos, samples, logs: >https://github.com/aybe/FFmpeg-PSX-STR-tests > >------ Original Message ------ >From "Michael Niedermayer" <michael@niedermayer.cc<mailto:michael@niedermayer.cc><mailto:michael@niedermayer.cc>> >To "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>> >Date 1/16/2024 12:42:49 AM >Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 > >On Mon, Jan 15, 2024 at 04:14:46PM +0000, aybe aybe wrote: >Hi! > >I just tried what you've suggested, using 150 and setting AVPacket->pts using sector MSF as LBA. > >The results are somewhat mixed: > >- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC >- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC > >can you send the patch for this plus links to one sample for both cases ? > >id like to take a look > >thx > >[...] >-- >Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > >The greatest way to live with honor in this world is to be what we pretend >to be. -- Socrates >_______________________________________________ >ffmpeg-devel mailing list >ffmpeg-devel@ffmpeg.org >https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >To unsubscribe, visit link above, or email >ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-01-16 14:56 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-01-02 2:49 [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 aybe aybe 2024-01-05 20:53 ` Michael Niedermayer 2024-01-06 12:31 ` aybe aybe 2024-01-10 2:37 ` Michael Niedermayer 2024-01-13 2:32 ` aybe aybe 2024-01-10 2:46 ` Michael Niedermayer 2024-01-13 2:28 ` aybe aybe 2024-01-14 20:38 ` Michael Niedermayer via ffmpeg-devel 2024-01-15 16:14 ` aybe aybe 2024-01-15 23:42 ` Michael Niedermayer 2024-01-16 14:27 ` aybe aybe 2024-01-16 14:32 ` aybe aybe [not found] ` <emd5d779f2-9283-4be7-82e5-afaf16ca635e@a51bcb19.com> 2024-01-16 14:39 ` aybe aybe 2024-01-16 14:56 ` aybe aybe
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git