Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Run a script using a file inserted by the user in Python
6 février 2017, par Georgе StoyanovI am trying to run a ffprobe command using a pre-defined by the user input file in Python. And then I will use the generated file by this command to report some parameters in a more organized view. My code is:
import subprocess import json cmd = "ffprobe -v quiet -print_format -show_format -show_streams /path/to/input/file.mp4 > output.json" subprocess.call(cmd.split()) with open('output.json') as json_data: data = json.load(json_data) json_data.close() d = float((data["streams"][0]["duration"])) t = (data["streams"][0]["time_base"]) fps = [float(x) for x in t.split('/')] print "==========================General==========================" print "Name of the File: %s" %(data["format"]["filename"]) print "Duration: %.2f minutes" %(d/60) print "Frame Rate: %d fps" %fps[1] print "Bitrate: %.2f Mbps" %(float(data["format"]["bit_rate"])/1000000)
I was thinking to use:
input_file = ("Please enter the path to your input file: ")
and then use the input_file in the ffprobe command on the second line of my code. But I am not sure how I can do it within the quotes. Please also note that the file name should also include an extension like input.mp4. -
RTMP Authentication for Wowza
6 février 2017, par James OantaI have a java encoder that currently does not support RTMP authentication.
I've done some research on how to implement that part this days but the RTMP protocol lacks of documentation regarding this and I couldn't find anything (very helpful) related to this.
Basically I have the following url schema: rtmp://user:pass@wowza_adress:1935/application
In the official documentation (V1.0) released by adobe there is no specification of any authentication command nor any RTMP authentication reference.
Could someone give me an hint/example on how this should be done ?
-
how to use ffmpeg video compression in android [on hold]
6 février 2017, par Muhammed FayazAs am trying to compress a video in android mobile. I got the techniques about ffmpeg, but am not able to fix this as am first in android developing. So anyone please help me to use ffmpeg in android
-
How can I resize an image then centralize it with a white background ? Can it be done using php-Imagine library ?
6 février 2017, par BOBOThe effect I would like to generate is exactly like the example in this StackOverflow thread: (Related Question)
1.Resize image
2.Keep proportion
3.Add or Fill none-image areas with white backgroundHere are three examples of this process below:
1. If original is square no matter 640*640 or 1024*1024, just resize it to target dimension e.g. 480*480 will work.
If the original input is vertical rectangular,the output should not be cropped and still be centerlized as below (the red dash edge marker is just make it easier to see the background is white and the proportion is kept after image resized to 480*480 px)
if the original input is horizontal rectangular, output like below, white background, keeps proportion and image uncroped , thus without losing anything after the image processing.
So after I've clarified such a question, I would like to know:
- Is there a general name of such Custom Image Resize mentioned above?
- would like to know how to achieve it using php image library Imagine? is it doable using php-imagine, or have to switch to another library, e.g imagemagick?
P.S. If you would like to achieve the effect either in image-resizing or video resizing, you can use below FFMPEG single-line command. (thanks to @Mulvya, yes below code applies both to videos and image formats)
[run below built-in code in ffmpeg console to achieve the mentioned resize effect]
[video resize]
ffmpeg -i "[raw video url or videofile location.mp4]" -vf "scale=iw*min(480/iw\,480/ih):ih*min(480/iw\,480/ih),pad=480:480:(480-iw)/2:(480-ih)/2:color=white" [save_path_and_filename].mp4
[image resize]
ffmpeg -i "[raw image url or imagefile location.jpg]" -vf "scale=iw*min(480/iw\,480/ih):ih*min(480/iw\,480/ih),pad=480:480:(480-iw)/2:(480-ih)/2:color=white" [save_path_and_filename].jpg
-
Bash FFMPEG - ".mp4 no such file or directory"
6 février 2017, par user2419553I'm using FFMPEG to save an .asf stream to an mp4 on my Ubuntu machine with the output file name being a timestamp. Here's the code:
current_time=$(date "+%m/%d/%Y_%H:%M:%S") ffmpeg -i http://username:password@IP:Port/videostream.asf -r 10 -vcodec copy -an -t 60 $current_time.mp4
However, I get an ".mp4 no such file or directory" error.