ffmpeg image sequence specify input framerate - input

I am trying to set the input framerate of a sequence of images (many folders):
if I am working with a single image sequence everything works properly:
ffmpeg -framerate 30 -i folder01/img%05d.jpeg -filter:v "crop=640:360" -r 30 outfilm.mp4
then, because I have more folders (and I was unable to get the -i concat:filesequence1|filesequence2 working) I tried to use:
ffmpeg -framerate 30 -f concat -safe 0 -i filelist.txt -filter:v "crop=640:360" -r 30 outfilm.mp4
but I receive an error:
Option framerate not found.
then if I omit the -framerate 30, everything runs smoothly, but ffmpeg defaults to a 25 fps value for the input image sequences.
Any ideas on how to fix this?

Use
ffmpeg -f concat -safe 0 -r 30 -i filelist.txt -filter:v "crop=640:360" -r 30 outfilm.mp4
When -r is used as an input option, it generates new timestamps at the given rate and sets that as the input framerate.

Related

ffmpeg always gives me input/output error for the first time running the command

I'm using ffmpeg to push raspberrypi video feeds (CSI camera) to a nginx-RTMP server then the nginx push it to youtube.
My problem is, every time when I run the ffmpeg command, it always gives me input/out error. Then it is working fine when I run the exact same ffmpeg command for the 2nd time.
How do I resolve this problem?
I want to start the ffmpeg command in a script file and put the script in crontab so that it can start the live streaming automatically. But this error makes it impossible to do that.
my ffmpeg command is as below(change the real domain name to mydomain.com):
ffmpeg -thread_queue_size 512 -f v4l2 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -input_format yuyv422 -video_size 1280x720 -framerate 30 -i /dev/video0 -vf eq=gamma=1.5:saturation=1.3 -c:v h264_omx -b:v 20480K -vsync 1 -g 16 -f flv rtmp://mydomain.com:1935/live/
the error log:
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 474200.421802, bitrate: 442368 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 442368 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
rtmp://rtmp.simonliu.space:1935/live/: Input/output error

How to capture screen and audio input and push to rtmp server?

I use avconv on ubuntu,I found this command
avconv -f alsa -i pulse -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -acodec libfaac -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv
to save as a file, and this command
avconv -i ./test.m4v -re -c copy -f flv "rtmp://localhost/livestream"
to push live stream.
How can I combine them together?
Firstly, you should ask such questions on video.stackexchange.com and not here.
Secondly, let's take apart the two commands that you have found:
-f alsa - format for the input is alsa
-i pulse - you are reading pulse (the pulseaudio driver)
-f x11grab - planning to read from the screen on x11
-r 25 -s 1280x720 - rate and size of the incoming video stream
-i :0.0+0,0 - this selects where the incoming video comes from
-acodec libfaac - here the output options start, you're setting audio code to libfaac, or at least trying to... since this option has been deprecated long time ago, currently -c:a would be used
-vcodec libx264 - setting video code, except that you should be using -c:v
-pre:0 lossless_ultrafast -threads 0 - some sort of parameters about how encoding should be done
video.mkv - this is the output file
And the second one
-i ./test.m4v - the file you're reading
-re - "Read input at native frame rate"
-c copy - do not reencode, but simply pipe as is
-f flv - the container format
"rtmp://localhost/livestream" - where you're planning to write all that.
When you understand that, it should be clear that what you are planning to do is to use the input and encoding part from the first command, and the format and output from the second one.
Here i didn't have time to check that everything that you found is working, you should do that yourself.

which commands line are used to take a screenshot on android device (except screencap)

I want to take a screenshot of my rooted samsung device using command line.
I have a constraint of time, I shouldn't exceed 2 s.
So my question is how can i take a screenshot using command line.
The following commands can be used to take a screenshot.
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png screenshot.png
Source
Update: After some research I've noticed a similar question that has an answer that might help you:
If the slow part is raw to png conversion (time adb shell screencap -p /sdcard/x.png is considerably slower than time adb shell screencap /sdcard/nonpng.raw, as I have it in games)
This shell script by max_plenert is a better example:
adb shell screencap /sdcard/mytmp/rock.raw
adb pull /sdcard/mytmp/rock.raw
adb shell rm /sdcard/mytmp/rock.raw
// remove the header
tail -c +13 rock.raw > rock.rgba
// extract width height and pixelformat:
hexdump -e '/4 "%d"' -s 0 -n 4 rock.raw
hexdump -e '/4 "%d"' -s 4 -n 4 rock.raw
hexdump -e '/4 "%d"' -s 8 -n 4 rock.raw
convert -size 480x800 -depth 8 rock.rgba rock.png
Source

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

avconv: getting aac to work. -strict experimental doesn't work

I am trying to get the following screencast command to work:
avconv -f alsa -ar 44100 -ac 2 -i default -acodec aac -strict experimental -ab 320k -f x11grab -s 1024x600 -r 24 -i :0.0 -vcodec rawvideo screencast.mp4
But I still get the following error:
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it
Other sites suggest making sure that the -strict experimental appears immediately after the aac parameter, which I have done, to no effect.
Move both the -acodec aac and -strict experimental to somewhere after the last -i parameter in the command line, before the output file name.
Parameters to avconv are parsed as "avconv [input1 options] -i input1 [input2 options] -i input2 [output options] outputfile", so when you added these parameters before the second -i they were interpreted as options to the second input, not to the output.