I am streaming from my android phone's camera to my computer using RTP. I am using VLC to receive the stream. I am also using a hand written .sdp file to view the stream in VLC. When I was doing this over RTSP I could uses the command line -> vlc "rtsp://224.1.1.1:8086" --network-caching=0 to remove the 1000ms caching that would remove the delay. So now I am using -> myTest.sdp --network-caching=0 but it seems to have no affect. I have tried increasing it to 10 seconds, still no affect. It also seems that if I lower the quality of the video it will have more of a delay. What do I need to do to remove any kind of caching / buffering and always just show the latest frame as it comes in?
I couldn't make VLC to have a delay less than 1 ms. So switching to ffplay with this parameters solved the problem:
ffplay.exe rtsp://224.1.1.1:8086 -fflags nobuffer -flags low_delay -avioflags direct -fflags discardcorrupt
Related
I am working with a raw h264 stream, this is a live stream coming from a device, however when the device is streaming a menu page that is static, it doesn’t send out a frame. I am feeding the stream back into a v4l2 loop back instance and then consuming this on a webpage via getUserMedia. The issue I have is that ffmpeg does not send frames to v4l2 when the hardware device is not sending frames. I have tried to set the output of ffmpeg to cfr and 60fps. However this doesn’t make it send out duplicates of the last frame. Is there anyway to achieve this?
Thanks in advance
Good day,
I'm currently writing a bash script which records the screen under certain conditions. The problem is that only avi works as a file extension for recording the screen. This script is going to be used on an Raspberry Pi and currently I get on a decent virtual machine only 10-20 fps (goal would be around 30 fps). I think .avi is not suited for my project. But .mpeg and .mp4 are not working for recording. I tried recording with .avi and then converting it in .mp4, but I have limited memory and .avi ist just too big in size. I use currently the following command:
ffmpeg -f x11grab -y -r 30 -s 960x750 -i :0.0+0,100 -vcodec huffyuv ./Videos/out_$now.avi
//$now is the current date and time
So I wanted to know if I need some special packages from ffmpeg to record with for example .mp4 or if there are other file formats available for ffmpeg screen recording.
Edit:
I found that the codec libx264 for mp4 works, but the fps drop until they hit5 fps, which is definetly too low. The recorded video appeared like being a fast forward version of the recorded screen.
With mpeg4 for mpeg I reached over 30 fps, but the video qualitywas very bad.
It appears that even my big avi-files look like being played fast forward. Is there something I do wrong?
Is there a good middle way, where I get a decend video quality, good fps (20+) and a file which isn't too big?
Edit 2:
I tried recording it with .avi and converting it afterwards. Just converting with ffmpeg -i test.avi -c:a aac -b:a 128k -c:v libx264 -crf 23 output.mp4
resulted in the same framedrops as if I was recording with .mp4. But when I cut a littlebit of the beginning of the video and named the outputfile .mp4, the size became much smaller. But when I started the cutting at 0:00:00 (so tried just converting), it just changed the file format without converting it (so the size stayed the same). Any ideas?
I created several MP4 files using ffmpeg. All of the videos have same settings and codec. Only difference is frames per second and duration. I then concatenated the videos using command below.
ffmpeg -f concat myList.txt -c copy output.mp4
I notice that when launching/opening the output.mp4 file in windows media player, it stops/freezes on the first frame of the video for about three four seconds and then starts playing, rest of the videos has correct fps and runs smoothly. Has anyone encountered this issue. I would like the video to start as soon as it is launched. Any suggestions to mitigate this issue?
Update: So far, I have found that the video length is exactly what I expect it to be.
ffprobe -i output.mp4
When i ffplay the video, it runs smoothly, but when I use windows media player, it gets stuck in first frame for about 4-5 seconds then plays smoothly. So I am going to assume that this issue is related to media players (buffers/loading before playing). Can't be sure though.
I solved this problem by converting my input files to avi and resizing them to the same size.
And then run
ffmpeg -i "concat:file1.avi|file2.avi|" -c copy out.avi
I'm trying to convert GIF files into WebM (ffmpeg, libvpx) and getting some strange ffmpeg behaviour.
ffmpeg is installed on my mac from MacPorts.
Converting with:
ffmpeg -i srcFilename.gif -b:v 600K -qmin 0 -qmax 50 -crf 5 destFilename.webm
if my GIF file has some frame(s) with 1-2s duration somewhere in the middle of animation like this, conversion result is fine - it's playing with the "pause" in the middle.
But if I have GIF like this with "pause" in the last frame, ffmpeg decodes it without a delay.
Have no idea why, spent some time reading ffmpeg manual, trying different conversion options with no success.
Any ideas? Thanks in advance!
I wrote an email to GIF decoder author and he answered me that he knows about this issue. It's located somewhere deep inside of ffmpeg and he has no idea how to fix it right now.
So, I'm using "dirty hack" in my project - just adding copy of last frame with zero delay to GIF file before encoding.
I would like to transcode video stream using ffmpeg tool and change only the video stream resolution, i.e. the video and audio parameters should remain the same.
According to the man page of the ffmpeg the following command line should provide the desired result:
ffmpeg -i input.mp4 -vcodec copy -acodec copy -s WxH output.avi
The Video codec of the input stream is compatible with avi container.
The actual result is that the resolution remains unchanged and it seems that the stream is just repacked in avi container.
The resolution of the output stream is changed successfully without -vcodec copy option, but the video codec is changed: h264 (Constrained Baseline) - > mpeg4 (Simple Profile).
When you copy a video stream, you cannot change any of its paramters, since… well, you're copying it. ffmpeg won't touch it in any way, so it can't change the dimensions, frame rate, et cetera.
Also, ffmpeg always chooses a default video codec if you don't specify one. For AVI files, that's mpeg4.
If you want H.264 video, choose -c:v libx264 instead (or -vcodec libx264 which is the same). If you need to keep the original profile, use -profile:v baseline.
Two things:
When you change the size, you will recode the video. This lowers the quality and might considerably harm the video. To compensate for this, you might need to set a higher quality level. You do this by setting the Constant Rate Factor to anything below the default of 23, e.g. with -crf 20. Experiment and see how your video looks like. If you have the time, add the -preset slow (or slower, veryslow), which will give you better compression.
Not that it matters in your case, since your input uses the Constrained Baseline profile, but note that H.264 in AVI is not properly supported, at least when using B pictures. Baseline doesn't support B pictures though, so you should be fine. It could happen that file can't be played back on some devices or players if you use the Main profile or anything above. I would rather mux it into an MP4 or MKV container, especially if your input file is MP4 anyway.