Re: [Mjpeg-users] y4mstabilizer segmentation fault
At 3:41 PM +0200 3/6/09, Hervé wrote: >hello, I'm not developper but it could not be a buffer concern? (it's >just an idea) Following this hint, I doubled the buffer sizes allocated by y4mstabilizer and it now works! I have no idea how much overkill this solution is... for all I know it may have been an off-by-one error. But this patch (below) got it working for me. As it turns out, this tool doesn't do what I wanted it to anyway. Thanks for all your help everyone. I've learned a good deal about all these tools, and I thought I knew them pretty well already! And @Mark Heath... I had seen your tools before, and I will have another look at them in future. You have some really interesting code there, and with a bit of cleaning up and packaging it could be a great supplement to mjpegtools. ...Richard. diff -U3 -r mjpegtools-1.9.0/lavtools/y4mstabilizer.c mjpegtools-1.9.0-patch/lavtools/y4mstabilizer.c --- mjpegtools-1.9.0/lavtools/y4mstabilizer.c 2007-04-03 01:43:33.0 +1000 +++ mjpegtools-1.9.0-patch/lavtools/y4mstabilizer.c 2009-06-04 10:12:06.0 +1000 @@ -1,5 +1,5 @@ /* - * $Id: y4mstabilizer.c,v 1.9 2007/04/01 18:06:06 sms00 Exp $ + * $Id: y4mstabilizer.c,v 1.10 2009/01/24 18:06:45 sms00 Exp $ * * written by J. Macropol * Framework and shifting code adapted from y4mshift by Steve Schultz. @@ -350,7 +350,7 @@ static void alloc_yuv (u_char **yuv, int h, int w) { -int len = h * w; +int len = h * w *2; int uvlen = Stab.nosuper ? (len / (SS_H * SS_V)) : len; yuv[0] = malloc(len); if (yuv[0] == NULL) -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users
Re: [Mjpeg-users] y4mstabilizer segmentation fault
At 10:19 AM +0200 3/6/09, Hervé wrote: >one tip to Richard: >if your contents is interlaced, deinterlace (from ffmpeg or another >mjpeg tool) >if your contents is progressive (and only the wrapper is interlaced), >correct headers with yuvcorrect That's interesting... ffmpeg -deinterlace -i "test.m2v" -f yuv4mpegpipe -pix_fmt yuv420p - | y4mscaler -v 0 -O sar=src -O chromass=444 | y4mstabilizer -v -v >test produces, among other things: INFO: [y4mstabilizer]interlace: top-field-first So, ffmepg is still calling the video interlaced. If I use yuvdeinterlace: ffmpeg -i "test.m2v" -f yuv4mpegpipe -pix_fmt yuv420p - | yuvdeinterlace | y4mscaler -v 0 -O sar=src -O chromass=444 | y4mstabilizer -v -v >test that line in the output changes to: INFO: [y4mstabilizer]interlace: none/progressive It still crashes after two frames though :( >a great tool, with a great result :-)) If only I could see what it produced! I'm starting to regret converting this system to 64 bit. ...R. -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users
Re: [Mjpeg-users] y4mstabilizer segmentation fault
Hi Steven, Wow, thanks for such a detailed response! At 9:10 PM -0700 2/6/09, Steven M. Schultz wrote: >mjpegtools build either from the last release (end of Dec 2009) >or from CVS (which hasn't changed too much)? I was using the atrpms RPM of mjpegtools 1.9.0. I then downloaded the 1.9.0 source and applied the patch from CVS for y4mstabilizer but that didn't help. I could try checking out the entire CVS tree but I don't think that would help. >ffmpeg doesn't know the rate or frame size? I would have thought >that none of those options would be necessary if the input stream >is properly formed. The command line is extracted from a larger script which accepts almost any file as input and converts it to a standard format (x264). So yes, it is designed to work with damaged streams, although in this case the stream is fine. >The PROBLEM the use of "-pix_fmt yuv444p". -pix_fmt does not >scale or resample the data!! -pix_fmt simply tells ffmpeg what >value to put into the yuv4mpeg header. Oops, I assumed ffmpeg would convert to the specified format. I have installed some extra tools, mpeg2dec and y4mscaler. >> Seems stream 0 codec frame rate differs from container frame >> rate: 50.00 (50/1) -> 25.00 (25/1) >ffmpeg is saying your input is 50 frames/sec? Hmmm, interesting. Yeah, it's been doing that for a while now. It bothers me but it does seem to work correctly regardless. >UGH! What is a PAR (Pixel Aspect Ratio) of 16:15? PAL is >something like 59:54 as I recall. But then I always ignored >the y4m header that ffmpeg output and put on my own ;) The file is 720x576 with an output DAR of 4:3. Which would be 768x576, or a PAR of 16:15. The other players I've tried all agree to display it at 768x576, correct or not! > ffmpeg -i test.m2v -pix_fmt yuv420p | \ > yyuvdeinterlace | \ > y4mscaler -v 0 -O sar=src -O chromass=444 | \ > y4mstablizer | \ > y4mscaler -v 0 -O sar=src -O chromass=420_MPEG2 | ... I tried that, with the same crash. This also results in the same crash: mpeg2dec -o pgmpipe test.m2v | pgmtoy4m -a 16:15 -i t -r 25:1 -x 420mpeg2 | yuvdeinterlace | y4mscaler -v 0 -O sar=src -O chromass=444 | y4mstabilizer -v -v | y4mscaler -v 0 -O sar=src -O chromass=420_MPEG2 > test INFO: [yuvdeinterlace] - INFO: [yuvdeinterlace]Motion-Compensating-Deinterlacer INFO: [yuvdeinterlace] - INFO: [yuvdeinterlace] SETTING EXTENDED MMX for MOTION! libmpeg2-0.5.1 - by Michel Lespinasse and Aaron Holtzman INFO: [pgmtoy4m] P5 cols: 720 rows: 864 maxval: 255 INFO: [yuvdeinterlace] Y4M-Stream is 720x576(420mpeg2) INFO: [yuvdeinterlace] Stream is interlaced, top-field-first. INFO: [y4mstabilizer] frame size: 720x576 pixels (1244160 bytes) INFO: [y4mstabilizer] chroma: 4:4:4 (no subsampling) INFO: [y4mstabilizer] frame rate: 25/1 fps (~25.00) INFO: [y4mstabilizer]interlace: none/progressive INFO: [y4mstabilizer] sample aspect ratio: 16:15 INFO: [y4mstabilizer] Frame 1 INFO: [y4mstabilizer] global motion xy*2=<0,3> Accumulated xy=<0,1.5> shift xy=0,-2> INFO: [y4mstabilizer] Frame 2 Segmentation fault (core dumped) The backtrace is the same as before. It's not getting very far and it's completely reproducible, which should make it fairly easy to track down the problem. I'm just not sure how to go about it. ...Richard. -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users
[Mjpeg-users] y4mstabilizer segmentation fault
Hi all, I'm running mjpegtools on a Centos 5 x86_64 (Intel) system and y4mstabilizer is crashing. My source file is a snippet of interlaced video from a DVD. I pre-process it with ffmpeg and pipe it into y4mstabilizer. I have also tried using yuvdeinterlace prior to y4mstabilizer but then it crashes on frame 2. I have applied the recent memmove patch... that didn't help. I have tried scaling the stream to 768x576 (SAR 1:1) but that didn't help either. My ffmpeg is from the atrpms RPM. Here's the setup and the results: $ ffmpeg -deinterlace -i "test.m2v" -r 25.000 -s 720x576 -aspect 4:3 -f yuv4mpegpipe -aspect 4:3 -pix_fmt yuv444p - | y4mstabilizer -v -v >/dev/null FFmpeg version 0.5-30.el5, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --disable-libamr-nb --disable-libamr-wb --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC --disable-stripping --extra-cflags=-I/usr/include/nvidia-graphics --extra-ldflags=-L/usr/lib64/nvidia-graphics libavutil 49.15. 0 / 49.15. 0 libavcodec52.20. 0 / 52.20. 0 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 15 2009 14:08:04, gcc: 4.1.2 20080704 (Red Hat 4.1.2-44) Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1) Input #0, mpegvideo, from 'test.m2v': Duration: 00:00:46.50, bitrate: 3938 kb/s Stream #0.0: Video: mpeg2video, yuv420p, 720x576 [PAR 16:15 DAR 4:3], 3938 kb/s, 25 tbr, 1200k tbn, 50 tbc Output #0, yuv4mpegpipe, to 'pipe:': Stream #0.0: Video: rawvideo, yuv444p, 720x576 [PAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding INFO: [y4mstabilizer] frame size: 720x576 pixels (1244160 bytes) INFO: [y4mstabilizer] chroma: 4:4:4 (no subsampling) INFO: [y4mstabilizer] frame rate: 25/1 fps (~25.00) INFO: [y4mstabilizer]interlace: top-field-first INFO: [y4mstabilizer] sample aspect ratio: 16:15 INFO: [y4mstabilizer] Frame 1 INFO: [y4mstabilizer] global motion xy*2=<0,1> Accumulated xy=<0,0.5> shift xy=0,-1> INFO: [y4mstabilizer] Frame 2 INFO: [y4mstabilizer] global motion xy*2=<0,0> Accumulated xy=<0,0.475> shift xy=0,0> INFO: [y4mstabilizer] Frame 3 INFO: [y4mstabilizer] global motion xy*2=<1,-2> Accumulated xy=<0.5,-0.54875> shift xy=-1,1> INFO: [y4mstabilizer] Frame 4 Segmentation fault (core dumped) $ ls core.6857 test.m2v test.ac3 $ gdb GNU gdb Red Hat Linux (6.5-37.el5rh) Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". (gdb) file /usr/bin/y4mstabilizer Reading symbols from /usr/bin/y4mstabilizer...Reading symbols from /usr/lib/debug/usr/bin/y4mstabilizer.debug...(no debugging symbols found)...done. Using host libthread_db library "/lib64/libthread_db.so.1". (no debugging symbols found)...done. (gdb) core core.6857 Reading symbols from /usr/lib64/libmjpegutils-1.9.so.0...Reading symbols from /usr/lib/debug/usr/lib64/libmjpegutils-1.9.so.0.0.0.debug...(no debugging symbols found)...done. (no debugging symbols found)...done. Loaded symbols for /usr/lib64/libmjpegutils-1.9.so.0 Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib64/libm.so.6 Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done. Loaded symbols for /lib64/libpthread.so.0 Reading symbols from /lib64/libc.so.6... (no debugging symbols found)...done. Loaded symbols for /lib64/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Core was generated by `y4mstabilizer -v -v'. Program terminated with signal 11, Segmentation fault. #0 0x004027a4 in calc_SAD_noaccel () (gdb) bt #0 0x004027a4 in calc_SAD_noaccel () #1 0x00402602 in motion () #2 0x00402378 in gmotion () #3 0x00401935 in main () #4 0x00345281d8b4 in __libc_start_main () from /lib64/libc.so.6 #5 0x00401139 in _start () (gdb)