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 2 Weeks Ago
baris35 baris35 is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 12 June 2017, 5:50 PM EDT
Posts: 101
Thanks: 43
Thanked 4 Times in 4 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; 2 Weeks Ago at 12:04 PM.. Reason: sorted
Sponsored Links
    #2  
Old Unix and Linux 2 Weeks Ago
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 20 June 2017, 6:17 PM EDT
Posts: 1,633
Thanks: 46
Thanked 622 Times in 583 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

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 06:26 AM.