LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-09-2008, 05:39 AM   #1
Thora
Member
 
Registered: Dec 2005
Location: Germany/Saxony
Distribution: openSUSE 11 / DSL 4.2.5
Posts: 39

Rep: Reputation: 15
bash: crash of transcode within script


Hi there,

I have a problem with a script I wrote. It's a script I want to use for streamlining and simplifying various repetitive raw video processing tasks.
The script gathers a few inputs from the user, then gathers information from the video and then calls mencoder and afterwards transcode for the actual video processing and encoding.

Now, my problem is that at the end of the encoding, transcode will crash. There will be only one frame missing in the processed video, but still, I'd rather avoid that, since I may want to extend this script to do batch-processing.

This only happens inside the script, if I do all the steps manually, there is no problem with transcode.

Thanks in advance for any ideas what might be amiss here. If you need any more information, just ask. ;)
 
Old 01-09-2008, 06:25 AM   #2
MonctonJohn
Member
 
Registered: Aug 2007
Location: Canada
Distribution: Mint
Posts: 112

Rep: Reputation: 15
How about posting the script and the output of the error.
 
Old 01-09-2008, 07:08 AM   #3
Thora
Member
 
Registered: Dec 2005
Location: Germany/Saxony
Distribution: openSUSE 11 / DSL 4.2.5
Posts: 39

Original Poster
Rep: Reputation: 15
Yes, probably should have done so in the first post.

Code:
#!/bin/bash

cd $HOME

echo "Arbeitsverzeichnis (Standard: $HOME/Temp): "
read wd
echo 'input file: '
read m_input
echo 'output file: '
read t_output
echo 'Format: '
echo '	1: NTSC '
echo '	2: NTSC-JP '
read rand
if [ $rand -eq 1 ]; then rand=38
else rand=40
fi

if [ -z $wd ]; then wd="$HOME/Temp"
fi	

tcprobe -i $wd/$m_input > $wd/tcprobe.tmp

framelength=`grep length $wd/tcprobe.tmp | cut -b 20-24`

if [ $framelength -lt 10000 ]; then framelength=`grep length $wd/tcprobe.tmp | cut -b 20-23`
fi 


mencoder "$wd/$m_input" -o "$wd/tempfile.avi" -ovc raw -vf crop=680:0:$rand:0,scale,format=yv12 -oac copy

transcode -C 3 -y xvid4 -J hqdn3d,dilyuvmmx,text=range=60-$framelength:string="example":font=/usr/share/fonts/truetype/FreeSans.ttf:points=12:dpi=120:fade=1:antialias=1:posdef=3,logo=file=/home/toni/Temp/logo2.gif:posdef=2:rgbswap -w 1600 -x raw -i "$wd/tempfile.avi" -o "$wd/$t_output"
So, nothing too fancy and at least I don't know what's wrong with that.

Then, there's two ways transcode will crash:

Code:
/home/toni/bin/raw_encode: line 32:  7005 Speicherzugriffsfehler
Where "Speicherzugriffsfehler" is the German equivalent for page segmentation fault, from what I've found on the web.

And the other:
Code:
*** glibc detected *** transcode: double free or corruption (out): 0x0000000000a43a50 ***
======= Backtrace: =========
/lib64/libc.so.6[0x2b449069921d]
/lib64/libc.so.6(cfree+0x76)[0x2b449069af76]
transcode(AVI_close+0xb7)[0x4392c7]
/usr/lib64/transcode/import_avi.so(tc_import+0x119)[0x2aaaac5aa729]
transcode(tca_import+0x32)[0x418da2]
transcode(import_close+0x8a)[0x416fda]
transcode(main+0x67a9)[0x4131b9]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x2b4490648b54]
transcode(memcpy+0x349)[0x40bcb9]
======= Memory map: ========
00400000-00450000 r-xp 00000000 08:01 1708120                            /usr/bin/transcode
0064f000-00652000 rw-p 0004f000 08:01 1708120                            /usr/bin/transcode
00652000-00a64000 rw-p 00652000 00:00 0                                  [heap]
40000000-40001000 ---p 40000000 00:00 0
40001000-40801000 rwxp 40001000 00:00 0
40801000-40802000 ---p 40801000 00:00 0
40802000-41002000 rwxp 40802000 00:00 0
41002000-41003000 ---p 41002000 00:00 0
41003000-41803000 rwxp 41003000 00:00 0
41803000-41804000 ---p 41803000 00:00 0
41804000-42004000 rwxp 41804000 00:00 0
42004000-42005000 ---p 42004000 00:00 0
42005000-42805000 rwxp 42005000 00:00 0
2aaaaaaac000-2aaaac5a9000 rw-p 2aaaaaaac000 00:00 0
2aaaac5a9000-2aaaac5ab000 r-xp 00000000 08:01 921622                     /usr/lib64/transcode/import_avi.so
2aaaac5ab000-2aaaac7aa000 ---p 00002000 08:01 921622                     /usr/lib64/transcode/import_avi.so
2aaaac7aa000-2aaaac7ac000 rw-p 00001000 08:01 921622                     /usr/lib64/transcode/import_avi.so
2aaaac7ac000-2aaaac7ae000 r-xp 00000000 08:01 921666                     /usr/lib64/transcode/import_raw.so
2aaaac7ae000-2aaaac9ad000 ---p 00002000 08:01 921666                     /usr/lib64/transcode/import_raw.so
2aaaac9ad000-2aaaac9af000 rw-p 00001000 08:01 921666                     /usr/lib64/transcode/import_raw.so
2aaaac9af000-2aaaac9b1000 r-xp 00000000 08:01 921547                     /usr/lib64/transcode/filter_hqdn3d.so
2aaaac9b1000-2aaaacbb1000 ---p 00002000 08:01 921547                     /usr/lib64/transcode/filter_hqdn3d.so
2aaaacbb1000-2aaaacbb3000 rw-p 00002000 08:01 921547                     /usr/lib64/transcode/filter_hqdn3d.so
2aaaacbb3000-2aaaacbb4000 r-xp 00000000 08:01 921527                     /usr/lib64/transcode/filter_dilyuvmmx.so
2aaaacbb4000-2aaaacdb3000 ---p 00001000 08:01 921527                     /usr/lib64/transcode/filter_dilyuvmmx.so
2aaaacdb3000-2aaaacdb5000 rw-p 00000000 08:01 921527                     /usr/lib64/transcode/filter_dilyuvmmx.so
2aaaacdb5000-2aaaacdb9000 r-xp 00000000 08:01 921604                     /usr/lib64/transcode/filter_text.so
2aaaacdb9000-2aaaacfb8000 ---p 00004000 08:01 921604                     /usr/lib64/transcode/filter_text.so
2aaaacfb8000-2aaaacfba000 rw-p 00003000 08:01 921604                     /usr/lib64/transcode/filter_text.so
2aaaacff2000-2aaaad06b000 r-xp 00000000 08:01 183941                     /usr/lib64/libfreetype.so.6.3.16
2aaaad06b000-2aaaad26a000 ---p 00079000 08:01 183941                     /usr/lib64/libfreetype.so.6.3.16
2aaaad26a000-2aaaad26e000 r--p 00078000 08:01 183941                     /usr/lib64/libfreetype.so.6.3.16
2aaaad26e000-2aaaad270000 rw-p 0007c000 08:01 183941                     /usr/lib64/libfreetype.so.6.3.16
2aaaad270000-2aaaad278000 r-xp 00000000 08:01 921556                     /usr/lib64/transcode/filter_logo.so
2aaaad278000-2aaaad477000 ---p 00008000 08:01 921556                     /usr/lib64/transcode/filter_logo.so
2aaaad477000-2aaaad479000 rw-p 00007000 08:01 921556                     /usr/lib64/transcode/filter_logo.so
2aaaad479000-2aaaad49e000 rw-p 2aaaad479000 00:00 0
2aaaad4b5000-2aaaad656000 r-xp 00000000 08:01 185908                     /usr/lib64/libMagick.so.10.0.8
2aaaad656000-2aaaad856000 ---p 001a1000 08:01 185908                     /usr/lib64/libMagick.so.10.0.8
2aaaad856000-2aaaad85b000 r--p 001a1000 08:01 185908                     /usr/lib64/libMagick.so.10.0.8
2aaaad85b000-2aaaad8a4000 rw-p 001a6000 08:01 185908                     /usr/lib64/libMagick.so.10.0.8
2aaaad8a4000-2aaaad8bc000 rw-p 2aaaad8a4000 00:00 0 /home/toni/bin/raw_encode: line 32:  6560 Abgebrochen
"Abgebrochen" means aborted.

Hope this helps.
 
Old 01-09-2008, 10:25 AM   #4
MonctonJohn
Member
 
Registered: Aug 2007
Location: Canada
Distribution: Mint
Posts: 112

Rep: Reputation: 15
I don't have a solid answer right now, but I will give your script a try at home after work and see what happens. Maybe I'll be able to track it down if I can see it running.

I'll let you know.
 
Old 01-09-2008, 10:56 AM   #5
Thora
Member
 
Registered: Dec 2005
Location: Germany/Saxony
Distribution: openSUSE 11 / DSL 4.2.5
Posts: 39

Original Poster
Rep: Reputation: 15
Yes, thanks in advance for trying.
Just keep in mind that this is pretty much specialized for my needs and a specific format of video, but I guess whether the result makes sense or not is not the point of that exercise.
 
Old 01-09-2008, 04:19 PM   #6
MonctonJohn
Member
 
Registered: Aug 2007
Location: Canada
Distribution: Mint
Posts: 112

Rep: Reputation: 15
Hi Thora,

I tried your script 3 times and every time transcode finishes without a problem. I did however have to change some of the options in the script to handle the different video size. I guess this means that the script is OK. I'm not too sure what would cause transcode to crash like that with only 1 frame to go.

Does it crash with both NTSC formats ($rand)?

Other than that I don't know where to look. Sorry

If you figure it let me know.
 
Old 01-09-2008, 05:25 PM   #7
Thora
Member
 
Registered: Dec 2005
Location: Germany/Saxony
Distribution: openSUSE 11 / DSL 4.2.5
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by MonctonJohn View Post
Hi Thora,

I tried your script 3 times and every time transcode finishes without a problem. I did however have to change some of the options in the script to handle the different video size. I guess this means that the script is OK. I'm not too sure what would cause transcode to crash like that with only 1 frame to go.
Thanks for trying. Maybe this is some weird problem with the packman suse build. I may at some later time try to use a self-built version, see what happens then. But that's for some other day, it's past midnight here and I'm tired ;)

Quote:
Does it crash with both NTSC formats ($rand)?
Just for your information, that option only changes a small detail in the mencoder crop-filter.
This is because when capturing from a TV-card there is a slight shifting of the actual video (2px) depending on the format of the source input, so that has to be adjusted in order to accurately crop the black borders ("Rand" actually means border in this case).
So yes, it will crash either way.

Quote:
Other than that I don't know where to look. Sorry :confused:
Nothing to worry about, in the end, and should a self-compiled transcode not work as well, I'll only lose about 2 or 3 frames and have to adjust one variable for everything after that.
But since the possibility existed that I've just plain overlooked something, I figured I might as well ask. ;)
 
Old 01-10-2008, 08:20 AM   #8
Thora
Member
 
Registered: Dec 2005
Location: Germany/Saxony
Distribution: openSUSE 11 / DSL 4.2.5
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Thora View Post
Maybe this is some weird problem with the packman suse build.
And it was. No trouble with the version I just built myself.

Case solved. ;)
 
Old 01-10-2008, 11:04 AM   #9
MonctonJohn
Member
 
Registered: Aug 2007
Location: Canada
Distribution: Mint
Posts: 112

Rep: Reputation: 15
Cool... good thinking.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
set variables in a bash script; ansi PS1 color script donnied Programming 4 11-21-2007 11:33 AM
Bash script to create bash script jag7720 Programming 10 09-10-2007 07:01 PM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
transcode crash schneidz Linux - Software 4 05-07-2006 01:50 AM


All times are GMT -5. The time now is 11:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration