15:06
I am running ffmpeg in python as a subprocess. I want to burn the subtitles into a video. Just using ffmpeg (commandline without python in windows) the following works:
ffmpeg.exe" -y -i "input_file" -vf "subtitles= \\'input_file_path\\' :si=0" -acodec copy "output_file_path"
the \\ escape characters are required by ffmpeg for special characters within a filter, However trying to replicate this within a python subprocess has proved problematic, here is one of many failed attempts:
command = (...)
15:07
I use ffmpeg to format videos according to tik-toke standards, but I don't know why videos are not cropped and lose quality.
const transcode = async () =>
const ffmpeg = ffmpegRef.current;
await ffmpeg.writeFile('input.mp4', await fetchFile(file));
await ffmpeg.exec([
'-i', 'input.mp4',
'-vf', 'scale=1080:1920,crop=ih*(9/16):ih',
'output.mp4'
]);
const data = await ffmpeg.readFile('output.mp4');
videoRef.current.src =
URL.createObjectURL(new Blob([data.buffer], (...)
13:13
I have a opengl buffer that I need to forward directly to ffmpeg to do the nvenc based h264 encoding.
My current way of doing this is glReadPixels to get the pixels out of the frame buffer and then passing that pointer into ffmpeg such that it can encode the frame into H264 packets for RTSP. However, this is bad because I have to copy bytes out of the GPU ram into CPU ram, to only copy them back into the GPU for encoding.
12:20
I tried it and sure enough I'm not typing the correct command in exec. Please let me know if you have a video resizing command for exec.
const compress = async () =>
const videoURL =
"../public/videos/20240508_095425.mp4";
const ffmpeg = ffmpegRef.current;
await ffmpeg.writeFile("input.mp4", await fetchFile(videoURL));
await ffmpeg.exec([
"-i",
"input.mp4",
"-c:v",
"copy",
"-c:a",
"aac",
"-b:a",
"128k",
"output.mp4",
]);
const fileData = await ffmpeg.readFile("output.mp4");
const data = new (...)