Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMPEG Overlay 1080X1920 video over 1280X720 video at a particular vertical position
9 mai 2019, par CRAIGI have a 1080X1920 (vertical) video with alpha channel with a blank spot 500px north of the bottom. This blank spot is 1080X607.
I have a 1280X720 sized video I want to position in that spot, so the 1280 video will have to be sized down to 1080 wide and then positioned 500px from the bottom and UNDER the video on top.
This is what I currently have, but it is failing beautifully.
/usr/local/bin/ffmpeg -i 1080x1920.mov -i 1280x720.MOV -filter_complex "[1][0]overlay=main_w-overlay_w-0:main_h-overlay_h-500" -c:v libx264 -profile:v high444 -pix_fmt yuv420p -level 3.1 -y final.mp4
-
Opening h264_nvenc encoder in ffmpeg takes about 1.5 seconds in Nvidia GPU
9 mai 2019, par farawayWe're using ffmpeg as a library and need to open several encoding sessions at the same time.
At first sessions, h264_nvenc opens very quickly but when session count has increased to 40, only avcodec_open takes 1.5 seconds.
Secondly, avcodec_open can open h264_nvenc one at a time so that if there are 40 sessions started at the same time, last session can take about 20 seconds to start
Do you have any idea about questions?
Regards,
-
How can I get ffmpeg to start downloading a stream at a specific time ?
9 mai 2019, par FiskFan1999If I know that a livestream is starting in a few hours, and I know the url of the livestream. If the stream is currently happening I have no problem using ffmpeg to save the stream to file. However, I am currently looking all over the web to find if there is a way for me to schedule a command to execute in the future. I have tried using "at", but that still seems to run the command in the present. I am wondering if "at" is the answer to my problem or if it is something else? Thank you.
I have tried using the at command and looking for other applications on MacOS to schedule commands.
Here is an example of the ffmpeg command that works perfectly for my intentions when I type it into the command line at present. What I am hoping is that I can get ffmpeg to start reading from the stream at a specific date and time and start writing to file from there.
ffmpeg -loglevel panic -nostdin -i [WEB_URL] -c:a aac -b:a 320k -crf 33 out.mp4
Here is my unsuccessful attempt to use at:
at 22:53; ffmpeg -loglevel panic -nostdin -i [WEB_URL] -c:a aac -b:a 320k -crf 33 out.mp4 &
What I expected was for ffmpeg to work as if I had entered in the command at the instant I scheduled the job for. However, ffmpeg started working immediately.
-
FFmpeg drawtext and live coordinates with sendcmd/zmq
9 mai 2019, par DavidKI'd like to use a marker on a live video source which has external live data to set x,y coordinates. sendcmd can read the text file but it won't update it, so later updates are not executed. Is it possible only with zmq? And if so, can I use zmq as a single filter (with drawtext), not with filter complex?
I have a python that exports live coordinates in the appropriate format to a cmd.txt file. I use unix time for the coordinates and I also copy the input timestamps from the live loopback device so they have almost the same time. There's a small delay so I have compensated the exported timestamps with +1.5s. This means the marker is moving for this extra period (while timestamps in cmd.txt are a bit ahead of the live source), but it won't update any more. I assume that FFmpeg reads this cmd.txt and won't update it any more but my python is writing it continuously.
Example line of the cmd.txt:
1557402120.3119707 drawtext reinit 'x=752:y=480';
This is the actual ffmpeg pipe:
ffmpeg -fflags nobuffer -vaapi_device /dev/dri/renderD128 -f v4l2 -i /dev/video0 -vf "sendcmd=f=cmd.txt,drawtext=fontfile=font.ttf:fontsize=30:fontcolor=white:r=25:text='o',format=nv12,hwupload" -copyts -c:v h264_vaapi -qp 24 -y 0.mp4
Source is a loopback device with unix time as input timestamp.
-
How to SRC files from S3 bucket
9 mai 2019, par JayThis code works perfectly on my local machine but I would like to move it to AWS Lambda
I have already uploaded ffmpeg as a binary dependency to the function layer
import subprocess p = subprocess.call( 'ffmpeg -r 1 -loop 1 -i "./ep1.png" -i "./ep1.mp3" -acodec copy -r 1 -shortest -vf scale=1280:720 ep1.flv', shell=True)
Question is How do I replace
"./ep1.png"
and
"./ep1.mp3"
as an understandable path for the ffmpeg command
This is documentation I found from boto3 but I'm not sure how to implement it
s3 = boto3.client('s3') s3.download_file('BUCKET_NAME', 'OBJECT_NAME', 'FILE_NAME')
Let me know if I'm heading in the right direction, after this step I would use boto3 to upload ep1.flv to an output S3 bucket