Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg exact start and end times
19 juin 2017, par Eng. M.HamdyI've searched a lot but didn't find what I nedd. I use this command:
ffmpeg -ss
-i -t -c copy to copy a part of the video, but the output file start time and duration may differ than "start" and "duration" specified. I understand that ffmpeg seeks to the nearest Keyframe and that precise seeking to a timestamp is not possible unless re-encoding the video (I tried that but the output video losses quality!). It's important to me to know the exact start and end timestamp that ffmpeg use to generate the output, because I use this info to adjust subtitle timing. Is there any way to make ffmpeg report start timestamp and end timestamp? Or else: Is there any way to know the previous and next keyframes to specific Timestamp, so I can adjust the video cut markers in my project to fit nearest keyframes?
Thanks.Update: - Is it possible to seek to the second keyframe, and to the keyframe before the last one? - what is the time interval between 2 keyframes?
-
ffmpeg raspberry raspbian rapivid streaming
18 juin 2017, par Nix042I am now playing with raspivid on Raspbian and a raspberry pi equipped with a PinoIR camera module.
I am almost done with the setup and have found a pre-compiled version of FFmpeg 3.1.1 to experiment a streaming to a youtube live stream by means of the command:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/
Is there any parameter I can use to also stream to a local machine (e.g. through a VLC client reading the stream) ?
I have achieved to do it in another bash with cvlc:
cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}':demux=h264
but executing both bashes at the same time is not possible as the input camera is locked by the system.
So, I looked in the ffmpeg documentation and found an interesting thread on multiple outputs : https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs. Then, I have tried the piped processes and another ffmpeg call to the inital command:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/
| ffmpeg -f h264 -i - -vcodec copy -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp It appears to have a syntax error, and maybe it is not the best way of achieving this. Could you please put me on the right track ?
Thanks and have a nice night !
Nicolas
-
Copy chapters in MP4 input stream to output stream in ffmpeg
18 juin 2017, par WheresWardyI'm using ffmpeg to copy two MP4 input streams into one output container and I'm having trouble maintaining the chapter indexes from both files into the output stream.
I have two files, specified by
streams.txt
which is in the correct format, that both contain an H.264 video stream, an AC-3 audio stream and an AAC audio stream, and am concatenating the two files using the followingffmpeg
command:ffmpeg -f concat -safe 0 -i streams.txt -map 0:0 -map 0:1 -map 0:2 -c:v copy -c:a:0 copy -c:a:1 copy output.mp4
This correctly produces the output file that I want, with both files combined into an output file with all three streams. I am however having trouble adding the chapters from both input files into the output one. I understand that I'm supposed to use the
-map_metadata
option, but I'm having trouble with the format of it that doesn't produce the following error message:Invalid chapter index 0 while processing metadata maps.
-
Encoding a video using preset not working except with ultrafast
18 juin 2017, par Muhammad UmarI am using following code to add overlay on my Video.
Here is the FFMPEG code.
String[] command = {"-y", "-i", videoFileName, "-i", tempFile.getAbsolutePath(), "-filter_complex", "[0:v]overlay=0:0", "-preset" , "superfast" , editedFile.getAbsolutePath(), };
It works fast if i use "ultrafast" However as u know the video quality is being reduced. However when i try to use
superfast
,fast
. The encoding is even faster than ultrafast and end result is a video which can not be played by the player.What is going on?
-
FFMPEG multiple crop on same video
18 juin 2017, par djdan_23I have one .mkv that have 4 sections in time that need to be cropped. (Meaning that the top-bot blacks bars appears sometimes during the viewing). How can I do that using FFMPEG. I know about crop for an entire film, but using it at 4 different places on the same video, that I don't. Thanks at advance.