Get FPS of the local video in react-native - react-native

I want to extract the FPS value of my video using react-native,
Please suggest the best available solution.
Thanks in advance

You can use FFmpeg with low level APIs.
Here is the Document :- FFmpeg Doc
FFmpeg for react-native (npm)
npm FFmpeg
And here is command for the extract FPS value from video
ffprobe -v 0 -of compact=p=0 -select_streams 0 \ -show_entries stream=r_frame_rate 'The Master (2022).mp4
Result wil be
r_frame_rate=24000/1001

Related

how to stream h265 video from ffmpeg to amazon s3?

I am trying to stream h265 video to aws s3 from ffmpeg, here is the command that i use:
ffmpeg -f gdigrab -i desktop -r 1 -vframes 5 -c:v libx265 -crf 40 -f mp4 pipe:1 | aws s3 cp - s3://videosbuket-009212/d5.mp4
and error information:
[mp4 # 000001c49541bb40] muxer does not support non seekable output
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
what's wrong here?
What’s wrong is that mp4 does not support non seekable output. Just like the error reads. Use a format that doesn’t not requires seeking, like mkv. If you require mp4, then you must make a local copy first.

How can I stabilize a video using FFMPEG in Android

I have built and successfully imported FFMPEG library in the android studio. How can I develop a program to stabilize a video using that?
You should implementate ffmpeg library with vid.stab like
https://github.com/tanersener/mobile-ffmpeg
You should give read/write storage permission
You should execute two ffmpeg commands:
-y -i $VIDEO -vf vidstabdetect=shakiness=10:accuracy=15:result=${VIDEO}trfFile -f null -
-y -i $VIDEO -vf vidstabtransform=smoothing=30:input=${VIDEO}output.mp4 -c:v mpeg4 /storage/emulated/0/Android/output.mp4
Where VIDEO is constant of your video path
It takes a lot of time because FFMPEG can't use phone GPU and render takes 2 minutes of 6 seconds of video.

Pipe PhantomJS output to FFmpeg

I am running PhantomJS using Selenium WebDriver (C#).
I'm trying to video record my browser using FFmpeg as shown in the 2 tutorials:
https://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg/
https://gist.github.com/phanan/e03f75082e6eb114a35c
As explained in the tutorials, I'll need to pipe output the phantomJS process to ffmpeg.
I know how to add arguments to phantomjs, like the following:
var svz = PhantomJSDriverService.CreateDefaultService();
svz.AddArgument("ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4");
var driver = new PhantomJSDriver(svz);
However, I don't know how to add the argument as pipe. I have tried adding the pipe symbol before the actual argument but that doesn't seem to work.
So, my question is, how do I pipe the output of PhantomJS using selenium webdriver?

Wrong frame rate when saving camera feed to a file using FFMPEG

I'm trying to save the live feed from an IP camera to a file but the resulting file always plays much faster than the original speed.
I have tried with the following commands:
ffmpeg -i http://171.22.3.47/image -vcodec copy -an -t 900 c:\output.mp4
ffmpeg -i http://171.22.3.47/image -c:v libx264 -an c:\output.mp4
Does anybody know what I'm missing? Both commands create the file and I can use Windows Media Player to play them, but they run much faster.
Try forcing output framerate by adding -r key
ffmpeg -i http://171.22.3.47/image -c:v libx264 -an -r 30 c:\output.mp4
You can also try to slow down the resulting video as an option. This will make output.mp4 2 times slower:
ffmpeg -i output.mp4 -filter:v "setpts=2.0*PTS" -c:v libx264 -an output-slow.mp4

FFMpeg UDP streaming - random split video effect

I'm trying to get a simple local preview of my webcam from an FFMpeg udp stream using an embedded Mplayer window. I can view the live stream using MPlayer but the image is unstable. I'm using the following FFMpeg command:
ffmpeg -f dshow -video_size 640x480 -i video="Lenovo EasyCamera" -an -f rawvideo -pix_fmt yuyv422 -r 15 udp://127.0.0.1:1234
And this is the MPlayer command:
mplayer -demuxer rawvideo -rawvideo fps=15:w=640:h=480:format=yuy2 -nofs -noquiet -identify -idle -slave -nomouseinput -framedrop -wid 1051072
Sometimes the stream image is OK, but intermittently the image tears randomly and this is how it looks (sorry, not enough rep for images in posts)
http://imgur.com/sLC3FW0
I have tried with FFPlay to see if it's a problem with MPlayer, but I get the same result:
ffplay -s 640x480 -pix_fmt yuyv422 -f rawvideo -i udp://127.0.0.1:1234
http://imgur.com/06L42Cj
This effect is happening at random. If I stop and restart the video might be OK, or it may look like the above. Using aything other than udp and rawvideo adds a delay to the video stream, which I want to avoid.
The FFMpeg streaming guide suggest methods when you get packet loss, but as far as I'm aware I don't seem to be getting that.
I'm new to FFMpeg/Mplayer/video streaming and any help or thoughts greatly appreciated.