ffprobe | simple ffprobe wrapper | Wrapper library
kandi X-RAY | ffprobe Summary
kandi X-RAY | ffprobe Summary
simple ffprobe wrapper
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ffprobe
ffprobe Key Features
ffprobe Examples and Code Snippets
Community Discussions
Trending Discussions on ffprobe
QUESTION
I have made a Python script whose task is to take a video file and split it up into separate videos of 60 secs each. Here's the code.
...ANSWER
Answered 2021-Jun-11 at 08:19Change -codec by -c and order all like
QUESTION
I have a file that I am reading that contains mp3 files.
...ANSWER
Answered 2021-Jun-10 at 15:09The input file should be redirected into the loop rather than the sort
command.
QUESTION
I am trying to submit my electron app to the windows store but whenever I do It gets rejected for this reason:
...ANSWER
Answered 2021-Mar-18 at 00:26Fixed, I was missing a tile image png file
QUESTION
I'm currently writing a small script in python to get metadata from my mp4 files using ffprobe. The problem is that I need to pass the filename in quotation marks, see:
...ANSWER
Answered 2021-May-27 at 12:19you can add quotes around the file in format string like this:"
QUESTION
Out of sheer curiosity I would like to know how this quoting dilemma can be fixed. I already solved the issue by circumnavigating it (I added [vcodec!*=av01] to the -f argument and simply removed the --exec part entirely). Otherwise it only worked, when there were no spaces or minus signs in the --exec argument. The culprit line is the last and the issue is at the end with the --exec argument. You can ignore the rest.
Thanks for your help on the road to enlightenment! ;-)
...ANSWER
Answered 2021-May-26 at 18:16Use another function to save you from the double indirection in a single command (parallel
executes youtube-dl
that executes avtomp4conv
). GNU parallel
uses your current shell to execute its commands, so no need for bash -c
here.
QUESTION
I wonder if someone can help explain what is happening?
I run 2 subprocesses, 1 for ffprobe and 1 for ffmpeg.
...ANSWER
Answered 2021-May-23 at 15:46What type is the ffmpegcmd
variable? Is it a string or a list/sequence?
Note that Windows and Linux/POSIX behave differently with the shell=True
parameter enabled or disabled. It matters whether ffmpegcmd
is a string or a list.
Direct excerpt from the documentation:
On POSIX with shell=True, the shell defaults to /bin/sh. If args is a string, the string specifies the command to execute through the shell. This means that the string must be formatted exactly as it would be when typed at the shell prompt. This includes, for example, quoting or backslash escaping filenames with spaces in them. If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional arguments to the shell itself. That is to say, Popen does the equivalent of:
Popen(['/bin/sh', '-c', args[0], args[1], ...])
On Windows with shell=True, the COMSPEC environment variable specifies the default shell. The only time you need to specify shell=True on Windows is when the command you wish to execute is built into the shell (e.g. dir or copy). You do not need shell=True to run a batch file or console-based executable.
QUESTION
Background: Could having audio as stream 0 and video as stream 1 explain why my MPG will play on OSX QuickTime Player, but not Win10 Movies & TV?
I've got an mpg file with audio as stream 0 and video as stream 1.
It plays fine under OSX QT Player, but not under Win10's default app.
For lack of a better idea, I'm assuming the unusual stream ordering is my problem, and I'm trying to fix it with ffmpeg.
What luck! https://trac.ffmpeg.org/wiki/Map describes exactly my case!
Re-order streams
The order of your -map options determines the order of the streams in the output. In this example the input file has audio as stream #0 and video as stream #1 (which is possible but unusual). Example to re-position video so it is listed first, followed by the audio:
ffmpeg -i input.mp4 -map 0:v -map 0:a -c copy output.mp4
This example stream copies (re-mux) with -c copy to avoid re-encoding.
I use exactly that command, but the flipping doesn't seem to work, like so:
...ANSWER
Answered 2021-Apr-13 at 00:26Tricky one this seemed at first. I wondered if this old FFmpeg trac ticket might hold the key:
There is no stream order in mpeg-ps. what you see from ffmpeg output order is likely just if a audio or video packet comes first
But that's not actually the problem; however it is worth noting that your file has a .mpg extension, when you should be trying to output an MP4 or MKV. ".mpg" is only valid if it contains legacy MPEG-1 and MPEG-2 formats. H.264 or AAC elementary streams are invalid.
If you've not created this file yourself, it's either a mislabelled container (e.g. MKV or MP4), or someone has bizarrely muxed the streams to .mpg. Note how FFmpeg warns you of the incompatible codec during your stream reorder attempt.
MPEG-PS is a packetised format, so there's no elementary streams as such. If it's genuinely an MPEG-PS file, it may be that an audio sample appears first. Either way, you should abandon using .mpg for your formats.
See the end of this answer for how you can use FFprobe to fairly accurately identify the actual container format.
I had another think, and finally a neuron reminded me about how the -map
output follows the order of assignment.
An important thing to note is that -map 0:v -map 0:a
doesn't quite work how you might expect it with files containing more than one of a stream type, as that syntax matches all applicable streams of that type.
Gyan has clarified that if you have a file with exactly one video and one audio stream, -map 0:v -map 0:a
will function equivalently to -map 0:1 -map 0:0
.
If you want to use the 0:a
syntax, if you have more than one audio for example you must address them individually, otherwise FFmpeg will group them when reordering. -map 0:a
will move both audios; -map 0:a:0
will move just the first audio.
The alternative, remembering to always check stream order in every file you manipulate, is to specify absolute stream numbers in the order you wish to have them in the output. So, -map 0:1 -map 0:0
if your video is the second of two streams in the source file.
For files with one video and one audio stream, you can use either method.
TestsI created an .MP4 file containing one H.264 video as stream 0:0 and one MP3 audio as stream 0:1.
Original file:
QUESTION
When I run ffprobe
, I get the standard metadata as below:
ANSWER
Answered 2021-Apr-29 at 15:13You may use shlex.split
or put the arguments to FFprobe in a list.
In Windows OS, you can use sp.run(f'ffprobe {video}'
...
In Linux and Mac, Python tries to execute the command as file name with spaces.
For example: 'ffprobe vid.mp4'
is considered a single executable command (file name with space).
You may use an arguments list:
sp.run(['ffprobe', f'{video}']
...
Or use shlex.split
for splitting the shell command to a list:
sp.run(shlex.split(f'ffprobe {video}'))
...
For simple parsing FFprobe output in Python:
- Execute ffprobe with
-of json
argument, and get the output in JSON format. - Convert the output string to dictionary using
json.loads
.
Here is a code sample that reads the output of FFprobe into a dictionary:
QUESTION
Essentially, I wish to concatenate a series of videos using MP4Box. When I attempt to do so, I receive the following error:
...ANSWER
Answered 2021-Apr-28 at 19:46File attributes must match, but they are different. See a list of attributes that must match for proper concatenation.
Important incongruities:
- H.264 profiles (High vs Constrained Baseline)
- Timebase (16384 tbn vs 30k tbn)
- And one is has audio while the other does not
This method is good if you need to add a short segment to a long video. It will leave the long video untouched and therefore will preserve the quality and it will be fast. Downside is that you have to make sure all of the attributes match which can be difficult if you are unfamiliar with this topic.
Example to make static.mp4
like 0.mp4
, using anullsrc filter to generate blank/silent/dummy/filler audio.
Re-encode:
QUESTION
i have a problem with ffmpeg when i run it in the cmd i havethe correct output "ffprobe passionfruit.mp4 -show_streams"
But when i use the same with subprocess :
...ANSWER
Answered 2021-Apr-21 at 15:49That's because your Windows terminal reads system's PATH or has otherwise defined path to the ffprobe
. When you run Popen
with shell=True
it runs the execution through shell that might or might not (your case) have access to that PATH.
Possible solutions:
- Provide full path to
ffprobe
(easiest):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ffprobe
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page