2> redirect won`t work in file or in rxvt run in file.

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

2> redirect won`t work in file or in rxvt run in file.

#1 Post by sunburnt »

I get no output from either line, but line #1 works in a live rxvt on the desktop.

Code: Select all

#!/bin/sh
######### Get ffmpeg installed codecs.
ffmpeg 2> /tmp/ffmpeg.tmp1
rxvt -e ffmpeg 2> /tmp/ffmpeg.tmp2
The rxvt line flashes rxvt, but I see no code executed and no output.

I`ve needed this for improving Puppy`s ripper app. also... ( Zigbert`s )
Plus for many CLI apps. it could give an accurate "percent done" output for a progress bar.
Last edited by sunburnt on Wed 15 Dec 2010, 15:57, edited 1 time in total.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#2 Post by jpeps »

I've had instances where '&>' worked where '2>' didn't.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

Thanks jpeps but no go... :?
I`ve run up against this little hassle a few times now with no solution.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post by amigo »

I think this will do what you want:
rxvt -e "ffmpeg 2> /tmp/ffmpeg.tmp2"
Your original would be re-directing the stderr of *rxvt* to the file, not that of ffmpeg.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

Sorry amigo, I thought you had it, and I know you`re right about the redirect.
But no go also... It doesn`t even work in a live rxvt running on the desktop.
This is the only thing so far that works running in a live rxvt:

Code: Select all

ffmpeg 2> /tmp/ffmpeg.tmp1
I need to generate the file in code of course.

I guess I may have to make a dialog to enter ffmpeg`s codecs manually... :x

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#6 Post by Pizzasgood »

On my non-Puppy system, I can catch the output via script without issues, so Puppy's ffmpeg must work differently than mine.

Anyway, I'm guessing that your ffmpeg is detecting that it isn't being run interactively, and therefor it changes its output behavior. I'm pretty sure you can trick a program into thinking it is being used interactively, but I don't remember how.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

pizzasgood; I thought about this ffmpeg not being compiled properly.
It`s a upgrade .pet for dpup, works well except for this little hiccup.
Come to think of it... It didn`t want to do Xvid 2-pass, but x264 2-pass works.

Puppy`s ffmpeg doesn`t have the newer codecs I think.
I seem to remember it didn`t work properly somehow, and so dpup`s upgrade...

### Is it possible to get a working compiled ffmpeg to try?

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#8 Post by zigbert »

I do this in Pmusic. - Had the same problem and solved it by

Code: Select all

echo 'exec ffmpeg 2> /tmp/ffmpeg.tmp1' > /file
chmod 722 /file
/file

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#9 Post by technosaurus »

ffmpeg is painful to work with using stdin/stderr: things that you think should go to stderr go to stdout and vice versa.

you tell ffmpeg to do something, it does it ... but tells you about it in stderr? how does that make any sense

I think I ended up dumping them together using:
ffmpeg ...parameters... 2>&1 >file
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#10 Post by sunburnt »

Thanks for all the help guys...
None of the code worked, I think it must be the ffmpeg I have.

Puppy`s ffmpeg doesn`t work right for some reason.
The dpup .pet package works ok for x264, but it has this odd behavior.

Is there another compile of ffmpeg that I could try?
I hate to download Ubuntu just to get ffmpeg out of it.
Or maybe one from the Debian repository will work properly.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#11 Post by trapster »

I've been using this one for my cli video converting.

Code: Select all

# ffmpeg   
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 15 2010 17:29:31 with gcc 4.2.2
  configuration: --prefix=/usr --cpu=i686 --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libfaad --enable-pthreads --enable-small --enable-postproc --enable-libvorbis --enable-gpl --enable-shared --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-debug --enable-bzlib --enable-zlib --enable-libspeex --enable-version3 --enable-runtime-cpudetect --enable-x11grab --enable-libtheora --enable-libxvid --enable-swscale --enable-mmx --enable-libvpx
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.73. 2 / 52.73. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
I'd have to dig to figure out where I got it from.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

trapster; I`d appreciate it if you could gzip your ffmpeg and post it here for me?
Your`s is almost a year newer compile, and hopefully it was done properly.

I`m hoping that it`s ffmpeg that`s my problem and not something else.
Mine just won`t pipe it`s output to a file from a script, and won`t do Xvid 2 pass.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#13 Post by trapster »

Here is the ffmpeg.tar.gz

I believe it was from THIS pet
Attachments
ffmpeg.tar.gz
ffmpeg version 0.6
Built on July 15, 2010 with gcc 4.2.2
(36.49 KiB) Downloaded 336 times
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#14 Post by sunburnt »

Thanks loads trapster, I`ll let you know how my luck does with it...
8)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#15 Post by sunburnt »

Wow !!! One thing I noticed right away is your`s is only 75k in size!
The one I have made for dpup is almost 2m in size!
I`m guessing I can`t just use ffmpeg exec., I will have to install the whole .pet.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#16 Post by technosaurus »

you _shouldn't_ see anything on the command line if you are redirecting stderr to a file because ffmpeg sporadically uses write(2,...) to output a lot to stderr, vice the traditional stdin which is write(1,...)

I don't know their reasoning for this - just that it makes it a PITA to parse the output.

piping through cat seems to work though

ffmpeg [parameters] 2>/dev/stdin |cat > [file]
or the equivalent
ffmpeg [parameters] 2>&1 |cat > [file]

if you want also to _see_ the output use tee instead of cat
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#17 Post by sunburnt »

Success!! Thanks technosaurus!

The problem... I had the code for this in a function, I put it in the main code...
Now I`m thinking some of the other suggestions will work also...

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#18 Post by jpeps »

technosaurus wrote: ffmpeg [parameters] 2>&1 |cat > [file]

if you want also to _see_ the output use tee instead of cat
without the redirection symbol 'tee file'

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#19 Post by sunburnt »

Speech codecs: amr, vpx, speex, and z and bz filtered out of the GUI list.
And the video and audio codecs are separated into two lists.

I don`t see a codec for Mpeg 2, is it still illegal to have it without paying?
And I don`t see the Flash codec, it`s popular (web) but it`s loosing favor I hear.
How about codecs for Ipod, PSP, and other portable video devices?
Are there any other codecs I should be looking for? wma, wmv, mp4, mov, etc.?

Thanks guys... Now I need to write code to make the GUI`s varying radio boxes.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#20 Post by big_bass »

Quite a few people posted here with good info
but I took this as a puzzle only (I like puzzles) and was bored :D
since this thread was solved but that -e command still bugged me

its easy without the -e
that changes how the command line is read
giving you a named window


I got this one to work

Code: Select all

 xterm -hold -e  "ffmpeg  | cat >/tmp/4"


I saw that amigo said to use the " " around the command and
piping to cat from technosaurus

but with rxvt it wouldnt work ?
Joe

Post Reply