Discussion:
[FFmpeg-user] Save ffmpeg output into file..
Luke Sakizloglou
2009-07-23 15:21:29 UTC
Permalink
Hi again,

i'm interested in saving the output ffmpeg displays when encoding in a
file..

Eventually i'm interested in making a chart of PSNR values of compressed
video images so i need to save the PSNR values in a file.

Is there a way to do that?

Thank you in advance.

Luke.
Greg McCrory
2009-07-23 16:54:26 UTC
Permalink
Post by Luke Sakizloglou
Hi again,
i'm interested in saving the output ffmpeg displays when encoding in a
file..
Eventually i'm interested in making a chart of PSNR values of
compressed video images so i need to save the PSNR values in a file.
Is there a way to do that?
Thank you in advance.
Luke.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Try this:

ffmpeg -psnr -i $inputfilename .... options .... $outputfilename 2>&1 |
grep PSNR > saved-psnr-data.txt
Luke Sakizloglou
2009-07-24 09:12:21 UTC
Permalink
Post by Greg McCrory
Post by Luke Sakizloglou
Hi again,
i'm interested in saving the output ffmpeg displays when encoding in a
file..
Eventually i'm interested in making a chart of PSNR values of
compressed video images so i need to save the PSNR values in a file.
Is there a way to do that?
Thank you in advance.
Luke.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
ffmpeg -psnr -i $inputfilename .... options .... $outputfilename 2>&1 |
grep PSNR > saved-psnr-data.txt
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Nope..that doesn't seem it work since it's producing an empty txt file

the command i'm typing is ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg
videoout.mpg 2>&1 | grep PSNR > saved-psnr-data.txt

any other ideas?

Luke.
Alexandre Ferrieux
2009-07-24 10:02:47 UTC
Permalink
Post by Luke Sakizloglou
Nope..that doesn't seem it work since it's producing an empty txt file
the command i'm typing is ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg
videoout.mpg 2>&1 | grep PSNR > saved-psnr-data.txt
any other ideas?
Well, don't grep, just save, you can look at the resulting file and
refine your filtering afterwards:

- Bourne Shell family:

ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg videoout.mpg >
saved-psnr-data.txt 2>&1

(note the order if redirections above)


- C shell family:

ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg videoout.mpg >&
saved-psnr-data.txt


-Alex
Luke Sakizloglou
2009-07-24 10:31:33 UTC
Permalink
Post by Alexandre Ferrieux
Post by Luke Sakizloglou
Nope..that doesn't seem it work since it's producing an empty txt file
the command i'm typing is ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg
videoout.mpg 2>&1 | grep PSNR > saved-psnr-data.txt
any other ideas?
Well, don't grep, just save, you can look at the resulting file and
ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg videoout.mpg >
saved-psnr-data.txt 2>&1
(note the order if redirections above)
ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg videoout.mpg >&
saved-psnr-data.txt
-Alex
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Thank you for solutions guys,

i also achieved what i wanted with the following commands:

ffmpeg -psnr -i videoin.mpg -b 400k -vstats -f mpeg videoout.mpg

(i hadn't noticed the vstasts flag before) and then:

grep PSNR logfile.log > PSNR.txt

but can i ask something else: what is the use of "2>&1" you put in the code?


Thank you
Alexandre FERRIEUX - FT/RD/SIRP/ASF/SOFTL
2009-07-24 11:22:13 UTC
Permalink
Post by Luke Sakizloglou
but can i ask something else: what is the use of "2>&1" you put in the code?
man sh ;-)

It means: redirect stderr to what is currently stdout (here the pipe to
grep). This way both stdout and stderr are blended and grepped together.

-Alex
Andy Nguyen
2009-07-27 04:09:57 UTC
Permalink
Post by Luke Sakizloglou
i'm interested in saving the output ffmpeg displays when encoding in a
file..
Eventually i'm interested in making a chart of PSNR values of
compressed video images so i need to save the PSNR values in a file.
ffmpeg -psnr -i $inputfilename .... options .... $outputfilename 2>&1 |
grep PSNR > saved-psnr-data.txt
Nope..that doesn't seem it work since it's producing an empty txt file
the command i'm typing is ffmpeg -psnr -i videoin.mpg -b 200k -f mpeg
videoout.mpg 2>&1 | grep PSNR > saved-psnr-data.txt
It worked for me (famous last words).

I noticed that you did not have a "-y" option to overwrite a "videoout.mpg"
that already exists. Could it be that the command was sitting there waiting
for a 'y' or 'n' answer from you, and you interrupted it before it got its
answer and therefore before it started processing and printing the
"...PSNR..." output lines?

(You would not have seen the prompt to respond 'y' or 'n' because that prompt
was swallowed by the "grep".)
--
Andy Nguyen
Continue reading on narkive:
Loading...