| View previous topic :: View next topic |
| Author |
Message |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Sun Jan 17, 2010 2:48 am Post subject: jpeg2yuv seg fault and how to downgrade jpeg[solved ~x86] |
|
|
I'm trying to downgrade jpeg 7 to the jpeg version in jpeg-compat
This bug: https://bugs.gentoo.org/show_bug.cgi?id=293919
is the problem I'm having with jpeg2yuv where I get a segfault just the same. Some people said I have to downgrade jpeg to fix this but I don't know how to do this! I've tried removing jpeg but this messes up the system really bad. I've tried installing jpeg-compat but this didn't help.
Is there some way I can make jpeg2yuv to work?
Thanks
[edit]
If you want to avoid trying to downgrade to jpeg-6b-r8 (believe me, you don't want to), from what I gather, the issue has been solved in ~x86 versions:
transcode-1.1.5-r1
mjpegtools-1.9.0-r1
Thanks for the hard work of those who solved this issue.Hopefully it will go stable soon.
If I'm incorrect, please let me know.
Issue was related to a change in jpeg-7 from jpeg6
Last edited by swingkyd on Sun Jan 24, 2010 3:42 am; edited 4 times in total |
|
| Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 54508 Location: 56N 3W
|
Posted: Sun Jan 17, 2010 12:09 pm Post subject: |
|
|
swingkyd,
Use your /etc/portage/package.mask file to mask jpeg-7
The entry will prevent only =media-libs/jpeg-7 being installed ... you will get media-libs/jpeg any higher versions when they are ready.
| Code: | | >=media-libs/jpeg-7 | will mask all versions >=7, in which case you will not get higher versions until you fix the mask. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Sun Jan 17, 2010 10:21 pm Post subject: |
|
|
| Its a mess. Unfortunately if you have multiple version of libjepg, it always links against the latest one. Furthermore, libjpeg was not orginally SLOT'd (but now is, however it is ~x86). So to make this work, the build scripts for jpeg2yuv (and transcode, which has the same problem), needs to be modified to link specifically again jpeg 6.2 . (Of course, this is only a workaround. A better solution would be to fix whatever causing them to crash. Unfortunately I don't know if the problem is in the application or libjpeg. ) |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 12:14 am Post subject: |
|
|
| salahx wrote: | | Its a mess. Unfortunately if you have multiple version of libjepg, it always links against the latest one. Furthermore, libjpeg was not orginally SLOT'd (but now is, however it is ~x86). So to make this work, the build scripts for jpeg2yuv (and transcode, which has the same problem), needs to be modified to link specifically again jpeg 6.2 . (Of course, this is only a workaround. A better solution would be to fix whatever causing them to crash. Unfortunately I don't know if the problem is in the application or libjpeg. ) |
So the question is, how dows one modify jpeg2yuv to link against jpeg 6.2...i'm just not sure!
Alternatively I was thinking of changing that operation jpeg2yuv with an mencoder equivalent if there is such a thing??
Is there some guide as to how to do this? I'm thinking it's a pretty big change to mjpegtools to link jpeg2yuv against jpeg 6.2... any ideas?
Thanks. |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 1:16 am Post subject: |
|
|
the offending command is the following:
| Code: | | /usr/bin/jpeg2yuv -n 30 -I p -f 29.97 -j "/home/k9copy/qdvd_talk1//Talk1/Main Menu VMGM/background.jpg" |/usr/bin/mpeg2enc -n n -f 8 -a 3 -o "/home/k9copy/qdvd_talk1//Talk1/Main Menu VMGM/menu.m2v" |
The jpeg2yuv is what messes up.
I'm trying to wade through the mencoder documentation and came up with something like the following:
| Code: | | mencoder mf://background.jpg -mf fps=29.97 -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=7500:aspect=16/9 |/usr/bin/mpeg2enc -n n -f 8 -a 3 -o "/home/k9copy/qdvd_talk1//Talk1/Main Menu VMGM/menu.m2v" |
This is just a guess so I'm really not sure if it would work. I'm not sure how to make it the same length that mpeg2enc would. ...of course, this is just a work-around until jpeg2yuv is fixed.
any ideas if this will work.
I've ran the code and got the following error:
| Quote: | INFO: [mpeg2enc] SETTING EXTENDED MMX for MOTION!
INFO: [mpeg2enc] SETTING SSE and MMX for TRANSFORM!
INFO: [mpeg2enc] SETTING EXTENDED MMX for PREDICTION!
**ERROR: [mpeg2enc] Could not read YUV4MPEG2 header: bad header magic!
|
|
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Mon Jan 18, 2010 2:22 am Post subject: |
|
|
There a number of ways to go about this.
But on way is as follows
Unmask the slotted versions of media-libs/jpeg in /etc/portage/package.keywords (Not needed for ~x86 users)
Uninstall jpeg-7 (warning, from this point on this will break anything linked to libjpeg)
| Code: |
emerge -C '>=media-libs/jpeg-7'
|
Install jpeg-6
| Code: |
emerge '<media-libs/jpeg-7'
|
Remerge any broken application (it would be nice if portage has a --replaceonly option, which would be the opposite of --noreplace: It would assume --oneshot and reinstall the package only if its already installed)
| Code: |
emerge -1 mjpegtools transcode
|
Reinstall jpeg-7 (This will fix any broken application):
| Code: |
emerge '>=media-libs/jpeg-7'
|
Note that if either problem application is ever update/rebuilt after this, you'll have to repeat the process, therefore, I highly recommend to build with --biuldpkg and make a copy of the resulting package somewhere for just that occasion (or use quickpkg)
Or, you could just package.mask any >=media-libs/jpeg-7, install jpeg-6, revdep-rebuild and never look back. The advantage of that is not having to repeat this procedure if mjpegtools / trasncode is updated/rebuilt.
Since there will temporarily be breaking binaries in the middle of this procedure, you might want to back up first.... |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 2:43 am Post subject: |
|
|
thanks for the step-by-step.. very helpful!...by any chance is the emerge for jpeg-6 incorrect? why unmask jpeg-8 then install jpeg-6? Isn't jpeg-compat the jpeg-6 library? can I just use that one?
what do you think?
thanks. |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Mon Jan 18, 2010 3:05 am Post subject: |
|
|
| swingkyd wrote: | thanks for the step-by-step.. very helpful!...by any chance is the emerge for jpeg-6 incorrect? why unmask jpeg-8 then install jpeg-6? Isn't jpeg-compat the jpeg-6 library? can I just use that one?
what do you think?
thanks. |
media-libs/jpeg is going slotted. The only reason media-libs/jpeg-compat existed was because at the time it was added into portage, it was NOT slotted.
It actually unmasks "less than - but not including version 8". Note while version 8 happens to exist, it need not have to. Its just an endpoint. This is so if there's a 7-r2 or 7.1 or 7.5678 or 7.9999, it will works right. We want to local stablize both jpeg 6 and 7 anyway. Note if you intend to downgrade to 6.2 and not look back, then you can change that line to '>media-libs/jpeg-7' which means "anything before, "but not including, jpeg-7". Some perfer =media-libs-6* (but that would match version 6c, 60, 68, 6321 - if they existed). or ~media-libs/jpeg-6b (which match revision numbers, but not version numbers - it match 6b-r1, 6b-r2... but not 6c or 6.1b). |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 3:49 am Post subject: |
|
|
on the line:
| Code: | | emerge -1 mjpegtools transcode |
I get the following error after installing the jpeg tools 6:
| Code: | checking for jpeg_start_compress in -ljpeg... no
configure: error: JPEG 6b library missing - Go to http://www.ijg.org/ |
and I get a failure to compile after this.
| Code: | # equery l jpeg
[ Searching for package 'jpeg' in all categories among: ]
* installed packages
[I--] [ ~] media-libs/jpeg-6b-r9 (62) |
so now it's not working ;( |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Mon Jan 18, 2010 4:43 am Post subject: |
|
|
You're right, I have the same problem (when I originally ran into this problem, the ebuilds weren't slotted yet. They were finally slotted as a result of jpeg-8 entering the tree: https://bugs.gentoo.org/show_bug.cgi?id=300782). Unfortunately the original ebuild is not in Portage anymore (presumable it could be retrieved from the Attic via CVS if desperate).
This is getting vexing. |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 7:12 am Post subject: |
|
|
| OK. my system is really messed now... no jpeg installed after trying the downgrade business. I masked jpeg-7 and up and installed jpeg-6b. now nothing will compile against jpeg-6b. a couple of hundred packages use libjpeg and none of them will install now. Any ideas on how to fix this? I could re-install jpeg-7 but this won't fix my issues with jpeg2yuv. *joy* |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Mon Jan 18, 2010 8:00 am Post subject: |
|
|
Unfortunately, I just synced and emerge, and one of the updates changed the soname of some Mozilla library, so xulrunner and evolution - probably 2 of longest to compile binaries, have to be rebuilt. Apparently, my system couldn't take the load, and GCC ICE'd while compiling xulrunner. It's time for me the head to sleep, and it unlikely I'll have any time to revisit this until the middle of the week.
I suggest undoing everything you've done in this thread at this point, and filing a bug on Gentoo Bugzilla that nothing compiles against the new slotted media-libs/jpeg (not necessarily in that order, as they'll want the output of the failing builds, among other things). |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Mon Jan 18, 2010 7:50 pm Post subject: |
|
|
Well... I really appreciate the effort!
After recompiling and installing jpeg-7 things were back to a normal state.
jpeg-7 installed as a slot against jpeg-6b. I still can't get transocode or mjpegtools to compile against it. |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Tue Jan 19, 2010 4:29 am Post subject: |
|
|
Ok, after looking at the "new" slotted ebuilds, I finally understand what's going on: The new slotted ebuilds for media-libs/jpeg ONLY add the .so file, except for the latest one, jpeg-8. So effectively the slotted media-libs/jpeg ebuilds les than 8 have effectively come to mean the same as media-libs/jpeg-compat !
So there's only 1 option left. Revive jpeg6 from the Attic, downgrade jpeg using the old ebuild, compile mjpegtools / trasncode against it, re-upgrade (to the "old" non-slotted jpeg-7)
Here's the old ebuild: Copy it to /usr/portage/local/media-libs/jpeg/jpeg-6b-r8.ebuild (or wherever you keep your local portage overlay):
| Code: |
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/media-libs/jpeg/Attic/jpeg-6b-r8.ebuild,v 1.15 2009/11/29 20:53:57 ssuominen dead $
inherit libtool eutils toolchain-funcs
PATCH_VER="1.6"
DESCRIPTION="Library to load, handle and manipulate images in the JPEG format"
HOMEPAGE="http://www.ijg.org/"
SRC_URI="ftp://ftp.uu.net/graphics/jpeg/${PN}src.v${PV}.tar.gz
mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
LICENSE="as-is"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
IUSE=""
RDEPEND=""
DEPEND="${RDEPEND}
>=sys-devel/libtool-1.5.10-r4"
src_unpack() {
unpack ${A}
cd "${S}"
EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
# hrmm. this is supposed to update it.
# true, the bug is here:
rm libtool-wrap
ln -s libtool libtool-wrap
elibtoolize
}
src_compile() {
tc-export CC RANLIB AR
econf \
--enable-shared \
--enable-static \
--enable-maxmem=64 \
|| die "econf failed"
emake || die "make failed"
emake -C "${WORKDIR}"/extra || die "make extra failed"
}
src_install() {
emake install DESTDIR="${D}" || die "install"
emake -C "${WORKDIR}"/extra install DESTDIR="${D}" || die "install extra"
dodoc README install.doc usage.doc wizard.doc change.log \
libjpeg.doc example.c structure.doc filelist.doc \
coderules.doc
}
|
You may need to copy /usr/portage/media-libs/jpeg/files to usr/portage/local/media-libs/jpeg/files as well. |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Thu Jan 21, 2010 5:06 pm Post subject: |
|
|
After masking all other versions, I get a "masked by corruption" error on the above ebuild! I suppose that's not good. Have you got it working?
This bug seems to be a jpeg thing. jpeg2yuv seems to be calling an extern command that just isn't there. So maybe it's a dependency thing or the jpeg guys changed their code significantly from 6b-r8. It looks like a memory access error which is a nasty pointer bug to debug. It just doesn't seem like anyone else has significant issues with this.
The result seems to be that it's not possible to convert jpegs to mpeg2 and so other programs which rely on this don't work.
*sigh* I wish I was competent enough to fix it myself but I'm just not. |
|
| Back to top |
|
 |
nakliyat34 n00b

Joined: 20 Jan 2010 Posts: 2
|
Posted: Thu Jan 21, 2010 5:58 pm Post subject: |
|
|
thanks for the step-by-step.. very helpful!...by any chance is the emerge for jpeg-6 incorrect? why unmask jpeg-8 then install jpeg-6? Isn't jpeg-compat the jpeg-6 library? can I just use that one?
what do you think?
thanks. _________________ evden eve nakliyat |
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Thu Jan 21, 2010 6:33 pm Post subject: |
|
|
Procedure doesn't actually work...yet... and the step-by-step has a few typos...I'm sure you caught them.
The problem with jpeg-compat is that nothing will compile against it. Same with jpeg-6b-r9. the ebuild jpeg-6b-r8 is said to be corrupt when I try to install it. |
|
| Back to top |
|
 |
gkmac Guru

Joined: 19 Jan 2003 Posts: 333 Location: West Sussex, UK
|
Posted: Thu Jan 21, 2010 10:05 pm Post subject: |
|
|
| swingkyd wrote: | | After masking all other versions, I get a "masked by corruption" error on the above ebuild! |
Try putting FEATURES="-strict" before the emerge command i.e. | Code: | | FEATURES="-strict" emerge =jpeg-6b-r8 |
_________________ If ~amd64 ebuilds are cutting edge, then git-9999 ebuilds are chainsaws.
"Not everyone can ride a unicycle, does that mean we should put another wheel on it?" - Lokheed |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
|
| Back to top |
|
 |
SamuliSuominen Retired Dev

Joined: 30 Sep 2005 Posts: 2133 Location: Finland
|
Posted: Fri Jan 22, 2010 5:12 pm Post subject: |
|
|
It doesn't segfault with this, http://paste.pocoo.org/show/168425/ but it isn't a complete patch, more of an workaround
It's mjpegtools that's broken, not jpeg, so restoring some old version is out of the question.
What really bothers me is that nobody has reported this to upstream bugtracking system at mjpegtools's sourceforge project page
| Code: | --- mjpegtools-1.9.0/lavtools/jpegutils.c 2005-10-02 20:48:44.000000000 +0200
+++ lavtools/jpegutils.c 2010-01-19 00:41:25.000000000 +0100
@@ -532,8 +532,8 @@
mjpeg_error( "YUV 4:4:4 sampling, but image height %d not dividable by 8 !\n", height);
goto ERR_EXIT;
}
+ }
- mjpeg_info("YUV 4:4:4 sampling encountered ! Allocating special row buffer\n");
for (y = 0; y < 16; y++) // allocate a special buffer for the extra sampling depth
{
//mjpeg_info("YUV 4:4:4 %d.\n",y);
@@ -543,7 +543,6 @@
//mjpeg_info("YUV 4:4:4 sampling encountered ! Allocating done.\n");
scanarray[1] = row1_444;
scanarray[2] = row2_444;
- }
/* Height match image height or be exact twice the image height */
@@ -741,15 +740,12 @@
jpeg_skip_ff (&dinfo);
}
- if (hsf[0] == 1)
- {
//mjpeg_info("YUV 4:4:4 sampling encountered ! Deallocating special row buffer\n");
for (y = 0; y < 16; y++) // allocate a special buffer for the extra sampling depth
{
free(row1_444[y]);
free(row2_444[y]);
}
- }
jpeg_destroy_decompress (&dinfo);
if(jerr.warning_seen)
|
|
|
| Back to top |
|
 |
swingkyd Guru

Joined: 13 Jan 2005 Posts: 334
|
Posted: Fri Jan 22, 2010 5:14 pm Post subject: |
|
|
I forgot the ebuild-manifest. That link you posted is where I found a copy of the one you posted here. This is pretty crazy. The issue runs across all libraries which try to call the jpeg library extern method (jpeg_read_raw_data) where it's crashing. Many applications seem to call this function (Cineralla, jpeg2yuv, transcode, mjpegtools etc.) do this so it's strange that the devs at gentoo wouldn't recognize it's not the same bug as in 293919. But I could be wrong...I'm no developer. there's bugs filed against all these program and they all seem to point to this method.
After rooting through some source files where these methods are defined, there is quite a bit of difference between them going from 6 to 7 to 8. You'd think we would not be the only ones who notice that jpeg transcoding causes a seg-fault. I just wish I could find a way to debug the problem myself.
Has anyone tried the jpeg2yuv command for a 16x16 (or was it 8x8) jpeg? The source goes on about something to do with even multiples of this for decompression. |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Sat Jan 23, 2010 6:55 am Post subject: |
|
|
I finally believe I have have the solution to the crashing. Reading the documentation in libjpeg, I believe its the correct one.
Its seem when doing dinfo.raw_data_out = TRUE one must now explicitly set dinfo.do_fancy_upsampling = FALSE . Once set, jpeg2yuv works normally again. I think it may apply on the input side too (raw_data_in = TRUE, do_fancy_downsampling = FALSE), which is where its crashing in transcode. Will create a patch for that (and cinelerra), but can only compile-test those 2. |
|
| Back to top |
|
 |
SamuliSuominen Retired Dev

Joined: 30 Sep 2005 Posts: 2133 Location: Finland
|
Posted: Sat Jan 23, 2010 12:18 pm Post subject: |
|
|
As-Salamu Alaykum Salah
It's now fixed in -r1 with your patch, same goes for transcode, -r1.
Now the only problem with jpeg-8 is outdated emul-linux-x86- packages for wine (and xawtv crash)
looking rather good, at last |
|
| Back to top |
|
 |
depontius Advocate

Joined: 05 May 2004 Posts: 3509
|
Posted: Sat Jan 23, 2010 7:31 pm Post subject: |
|
|
Pardon me for jumping in rather ignorantly, but by this morning I've finally realized that my transcoding is just plain fundamentally broken. I've been having minor bugs and hitches for a while, but thought I was working around them. As of this morning I realize that it's not "working with a few problems", but "broken with a few things that work." Searching around the forums got me to this thread, which I believe is most relevant.
It appears that the fix is in "-r1", but is that "jpeg-7-r1" which I see in my portage tree, or "transcode-1.1.5-r1", which I don't? If the latter, will I get it after tonight's sync, or is it in a private tree somewhere.
For me there's a little bit of urgency to this. My /media partition is 93% (of 300GB) full, and early Monday morning SciFi is running a bunch of "Joan of Arcadia" that I want to record for my wife. I may or may not have enough room, and would like to peel some stuff off onto DVD (xvid encoded) before then. Right now I appear to have no way to get to xvid. (Not transcode, ffmpeg, or mencoder)
It looks to me as if the problem has been solved here, but the path has been a bit roundabout and torturous. Could someone make a quick summary, or some such, for us Johnny-come-latelys?
EDIT
Related... I've also masked ">=media-video/mjpegtools-1.8.99999", though at the moment I don't remember why, or if there is any relationship to this problem. Does this ring a bell to anyone? _________________ .sigs waste space and bandwidth |
|
| Back to top |
|
 |
salahx Guru

Joined: 12 Mar 2005 Posts: 549
|
Posted: Sat Jan 23, 2010 9:12 pm Post subject: |
|
|
mjpegtools-1.9..0-r1 and transcode-1.1.5-r1. are in the tree (but ~x86), however they were just added not that long ago you they might not appear until the next sync. I've also create a patch for Cinelerra too, bug 292575, which has the same problem.
Earlier in the thread, we were trying to downgrade to jpeg-6b-r8 in a futile effort, which is now entirely unnecessary.
The whole start of this is tovid (which uses mjpegtools and transcode) started crashing when jpeg-7 was released. Now, with mjpegtools and transcode patched, tovid should work without any mangling or masking of jpeg.
If you're experiencing the same crash as in bugs 293919, 292575, 294488, but in a different program, then it needs a similar patch like the other 3. However, if you are having some other problem (different kind of crash, or not crash related), its a different problem.
I don't know why you have >=media-video/mjpegtools-1.8.99999 masked, but note I only patched media-libs/mjpegtools-1.9, not 1.8 (but it would be easy to backport if for some reason you cannot use 1.9). But again, it only helps only if you're experiencing the crash listed in those 3 bugs. |
|
| Back to top |
|
 |
|