How to decode a video at a certain fps using ffmpeg - ffmpeg

I am working on video decoding using FFmpeg.
When I try to decode a video which is encoded with h265 at a certain fps (ex: fps=25), the result is a decoded video but at a different fps.
How can I decode a video at exactly fps=25, even if I have a high miss rate or dropped frames?
I use this command to decode:
ffmpeg -benchmark -i -f null /dev/null
I am running the above command on Odroid-XU3 board that contains 8 cores. The OS is Ubuntu 14.04 LTS.
Please, any help is welcome.
Thank you in advance.

You can add ‘-re’ to the ffmpeg command lint to process in real time. Ffmpeg will not drop frames though. So if it can’t decode that fast, you will still fall behind.

Related

FFmpeg Some Questions about dshow command

Recently, I've built ffmpeg(ver 4.1.1) 32bit on my Windows, trying to put SRT stream to Internet.When I use -dshow command, I can use both -list_device and -list_options to find my camera correctly.But once I use ffplay to play my Camera,it doesn't respond.
On the other hand, I can use vfwcap command to play my Camera successfully through "ffplay -f vfwcap -i 0",but this is not what I want. Because I also want to put my Microphone device at the same time.
This problem has bothered me for a week that I can't find the right solution over Internet.I've tried to add the parameters which my camera may need.But it appear the same problem.
If you have time, can you try to help me?Or can you guide me where the problem may arise.I will be very grateful for your help.I look forward to your reply.
Actually,my final target is to use dshow cammand to display my camera and push the stream using SRT at the same time.So that I can pull the SRT stream at another computer to compare two screen and then get the delay Intuitively and visually.I've built SRT(32bit) and ffmpeg(32bit v4.1.1) successfully,but my dshow command seems like that it doesn't work well.

Capture video using FFMPEG without frozen image effect

Anyone could help me? Have been trying to record video from an RTSP server using FFMPEG but somehow the video result has many frozen images (couldn't be used for any people detection) - the people look similar to this:
Here is the code I used:
ffmpeg -i rtsp://10.10.10.10/encoder1 -b:v 1024k -s 640x480 -an -t 60 -r 12.5 output.mp4
What I have done so far?
- Recorded the video in smaller dimension instead of original one
- No audio and lower FPS
- Even only record from two IP sources on a machine
But still didn't get any luck yet. Anyone ever experience this?

Extract frames as images from an RTMP stream in real-time

I am streaming short videos (4 or 5 seconds) encoded in H264 at 15 fps in VGA quality from different clients to a server using RTMP which produced an FLV file. I need to analyse the frames from the video as images as soon as possible so I need the frames to be written as PNG images as they are received.
Currently I use Wowza to receive the streams and I have tried using the transcoder API to access the individual frames and write them to PNGs. This partially works but there is about a second delay before the transcoder starts processing and when the stream ends Wowza flushes its buffers causing the last second not to get transcoded meaning I can lose the last 25% of the video frames. I have tried to find a workaround but Wowza say that it is not possible to prevent the buffer getting flushed. It is also not the ideal solution because there is a 1 second delay before I start getting frames and I have to re-encode the video when using the transcoder which is computationally expensive and unnecessarily for my needs.
I have also tried piping a video in real-time to FFmpeg and getting it to produce the PNG images but unfortunately it waits until it receives the entire video before producing the PNG frames.
How can I extract all of the frames from the stream as close to real-time as possible? I don’t mind what language or technology is used as long as it can run on a Linux server. I would be happy to use FFmpeg if I can find a way to get it to write the images while it is still receiving the video or even Wowza if I can find a way not to lose frames and not to re-encode.
Thanks for any help or suggestions.
Since you linked this question from the red5 user list, I'll add my two cents. You may certainly grab the video frames on the server side, but the issue you'll run into is transcoding from h.264 into PNG. The easiest was would be to use ffmpeg / avconv after getting the VideoData object. Here is a post that gives some details about getting the VideoData: http://red5.5842.n7.nabble.com/Snapshot-Image-from-VideoData-td44603.html
Another option is on the player side using one of Dan Rossi's FlowPlayer plugins: http://flowplayer.electroteque.org/snapshot
I finally found a way to do this with FFmpeg. The trick was to disable audio, use a different flv meta data analyser and to reduce the duration that FFmpeg waits for before processing. My FFmpeg command now starts like this:
ffmpeg -an -flv_metadata 1 -analyzeduration 1 ...
This starts producing frames within a second of receiving an input from a pipe so writes the streamed frames pretty close to real-time.

What parameters or software is best to use to convert .MP4 to .FLV

I'm on Windows 7 and i have many .MP4 video that i want to convert on .flv. I have try ffmpeg and Free FLV converter, but each time the results are not what i'm looking for.
I want a video of same quality (or almost, looking good) and a more little size for the video, because right now, each time i have made a try, the video result is pretty bad and the video size just increase.
How can i have a good looking video, less in size and in .FLV ?
Thanks a lot !
First, see slhck's blog post on superuser for a good FFmpeg tutorial. FLV is a container format and can support several different video formats such as H.264 and audio formats such as AAC and MP3. The MP4 container can also support H.264 and AAC, so if your input uses these formats then you can simply "copy and paste" the video and audio from the mp4 to the flv. This will preserve the quality because there is no re-encoding. These two examples do the same thing, which is copying video and audio from the mp4 to the flv, but the ffmpeg syntax varies depending on your ffmpeg version. If one doesn't work then try the other:
ffmpeg -i input.mp4 -c copy output.flv
ffmpeg -i input.mp4 -vcodec copy -acodec copy output.flv
However, you did not supply any information about your input, so these examples may not work for you. To reduce the file size you will need to re-encode. The link I provided shows how to do that. Pay special attention to the Constant Rate Factor section.

FFMpeg crashes on decoding MJpeg

I'm working with FFMpeg for decoding Mjpeg streams.
Recently I've bumped into access violation exceptions from FFMpeg, after investigating, I found that due to network packet drops, I'm passing to the FFMpeg a frame that might have "gaps" in it.
The FFMpeg probably crash since it jumps to a marker payload which doesn't exist in the frame's memory.
Any idea where I can find a mjpeg structure validator?
Is there any way to configure FFMpeg to perform such validations by itself?
Thanks.
I would be inclined to use Gstreamer here instead of ffmpeg and set "max-errors" property in jpegdec plugin to -1.
gst-launch -v souphttpsrc location="http://[ip]:[port]/[dir]/xxx.cgi" do-timestamp=true is_live=true ! multipartdemux ! jpegdec max-errors=-1 ! ffmpegcolorspace ! autovideosink.
This takes care of the corrupt jpeg frames and continues the stream.
Didn't really found an answer to the question.
Apparently, ffmpeg doesn't handle corrupted frames very well.
Decided to try a different 3rd party decoder instead of ffmpeg. For now, at least for Jpeg, it works faster and much more robust.

Resources