Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to print file info with FFprobe?

Shell Programming and Scripting


Tags
ffprobe stream info record

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-11-2017
baris35 baris35 is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 18 August 2017, 11:29 PM EDT
Posts: 117
Thanks: 54
Thanked 5 Times in 5 Posts
How to print file info with FFprobe?

Hello,

I have many mp4 files inside a folder and I need to write stream info of each files.
Below script creates txt files but inside of each file is empty.


Code:
#!/bin/bash
for video in *.mp4;
do
	base="${video%.mp4}"
	ffprobe -i "$base".mp4  > "$base".txt;
done
exit 0

When I run similar code without for loop like

Code:
ffprobe -i filename.mp4

it prints out desired output.
Maybe I should pipe the output...

I'd like to know how it should be done
Many thanks for your help.

Boris

---------- Post updated at 11:01 AM ---------- Previous update was at 10:37 AM ----------

Sorted now...



Code:
#!/bin/bash
for video in *.mp4;
do
	base="${video%.mp4}"
	ffprobe -i "$base".mp4 2>>"$base".txt
done
exit 0


Thanks
Boris

Last edited by baris35; 06-11-2017 at 12:04 PM.. Reason: sorted
Sponsored Links
    #2  
Old Unix and Linux 06-11-2017
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 2 August 2017, 1:08 AM EDT
Posts: 1,633
Thanks: 46
Thanked 623 Times in 584 Posts
Quote:
Originally Posted by baris35 View Post
[...]

---------- Post updated at 11:01 AM ---------- Previous update was at 10:37 AM ----------

Sorted now...



Code:
#!/bin/bash
for video in *.mp4;
do
	base="${video%.mp4}"
	ffprobe -i "$base".mp4 2>>"$base".txt
done
exit 0


Thanks
Boris
Are you certain that you would like to just record the stderr to the .txt file?

Could it be that you would like stdout?

Code:
ffprobe -i "$base".mp4 >> "$base".txt

or both stream.

Code:
ffprobe -i "$base".mp4 >> "$base".txt 2>&1

The Following User Says Thank You to Aia For This Useful Post:
baris35 (06-30-2017)
Sponsored Links
    #3  
Old Unix and Linux 06-30-2017
baris35 baris35 is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 18 August 2017, 11:29 PM EDT
Posts: 117
Thanks: 54
Thanked 5 Times in 5 Posts
Hello Aia,
Thanks for your reply
Your code also gives desired output.


Kind regards
Boris
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Inputing info from a CSV file and filling a template file mojoman Shell Programming and Scripting 1 11-04-2015 12:52 PM
Print info in console or not judged by variable yanglei_fage Shell Programming and Scripting 1 09-28-2014 01:18 PM
Howto Print File Path or Print the Filename overkill Shell Programming and Scripting 1 10-09-2009 01:00 AM
Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names nikosey Shell Programming and Scripting 6 07-30-2008 09:46 PM
file activity (open/closed) file descriptor info using KORN shell scripting Gary Dunn UNIX for Dummies Questions & Answers 3 06-07-2004 01:54 PM



All times are GMT -4. The time now is 11:05 AM.