Hello everyone here I have a problem this code works well with 1080x1080 images but if I put 1920x1080 images does it no longer work? can someone tell me why or put me on a track thank you
fmpeg/ffmpeg \
-loop 1 -t 3 -i agence_quatre_img/1669992356.png \
-loop 1 -t 3 -i agence_quatre_img/1669992343.png \
-loop 1 -t 3 -i agence_quatre_img/1669992317.png \
-loop 1 -t 3 -i agence_quatre_img/1669992290.png \
-loop 1 -t 3 -i agence_quatre_img/1669992290.png \
-filter_complex \
"[1]fade=d=1:t=in:alpha=1,setpts=PTS-STARTPTS+4/TB[f0]; \
[2]fade=d=1:t=in:alpha=1,setpts=PTS-STARTPTS+8/TB[f1]; \
[3]fade=d=1:t=in:alpha=1,setpts=PTS-STARTPTS+10/TB[f2]; \
[4]fade=d=1:t=in:alpha=1,setpts=PTS-STARTPTS+12/TB[f3]; \
[0][f0]overlay[bg1];[bg1][f1]overlay[bg2];[bg2][f2]overlay[bg3]; \
[bg3][f3]overlay,format=yuv420p[v]" -map "[v]" agence_quatre_img/output.mov
Related
Using ffmpeg, I get the warning
Warning: data is not aligned! This can lead to a speed loss
In my case, speed an cpu consuption matter.
I found two discussions about that. Both are quite old:
https://ffmpeg.org/pipermail/ffmpeg-user/2017-October/037501.html#:~:text=This%20can%20lead%20to%20a%20speedloss.%20%3E,(i.e.%20may%20be%20slower).
https://superuser.com/questions/728795/new-ffmpeg-swscaler-0xa314080-warning-data-is-not-aligned-this-can-lead
Every cropping and also every rescaling process as well as the placement of the pip is a multiple of 16 in my case. Also the input (2560x1920) meets that criteria.
Here is the code:
/usr/bin/ffmpeg \
-fflags nobuffer \
-rtsp_transport tcp \
-i 'rtsp://XXX' \
-timeout 6000000 \
-r 0.5 \
-copyts \
-an \
-hls_flags delete_segments+append_list \
-filter_complex \
"[0:v]split=2[a][b];\
[a]scale=768:576[c];\
[b]crop=256:272:1008:608,scale=320:240[d];\
[d]pad=w=16+iw:h=16+ih:x=16:y=16:color=#ff78a8[e];\
[c][e]overlay=0+16:0+32[f]" \
-map "[f]" \
-c:v libx264 -preset veryfast -r 0.5 -g 0.5 -sc_threshold 0 \
-f segment \
-segment_list_flags live \
-segment_time 3 \
-segment_list_size 3 \
-segment_format mpegts \
-segment_list_type m3u8 \
-segment_list_entry_prefix /XXX/stream/ \
-segment_list /var/www/video_streaming/XXX/index_4.m3u8 \
/var/www/video_streaming/XXX/stream/s4_%d.ts
Any idea how to fix this?
So I have the following process of ingesting rtsp and output hls.
ffmpeg -fflags nobuffer \
-rtsp_transport udp \
-i rtsp://<source>/ \
-vsync 0 \
-copyts \
-vcodec copy \
-movflags frag_keyframe+empty_moov \
-an \
-hls_flags delete_segments \
-f segment \
-segment_list_flags live \
-segment_time 1 \
-segment_list_size 5 \
-segment_format mpegts \
-segment_list streaming.m3u8 \
-segment_list_type m3u8 \
-segment_list_entry_prefix ./ \
%d.ts
and I want to also output screenshots from the stream at some fixed frequency. Say every second.
I've tried a variety of options including
-vframes 1 -q:v 10 capture.jpeg
and its not working.
Any suggestions?
ffmpeg -fflags nobuffer \
-rtsp_transport udp \
-i rtsp://<source>/ \
-vsync 0 \
-copyts \
-vcodec copy \
-movflags frag_keyframe+empty_moov \
-an \
-hls_flags delete_segments \
-f segment \
-segment_list_flags live \
-segment_time 1 \
-segment_list_size 5 \
-segment_format mpegts \
-segment_list streaming.m3u8 \
-segment_list_type m3u8 \
-segment_list_entry_prefix ./ \
%d.ts \
-q:v 10 -vf fps=1 output_%03d.jpg
I am using the following command to restream a video stream to another server, but if the source/destination momentarily drops, ffmpeg gives up.
ffmpeg \
-i http://source_stream_ip:port \
-reconnect_at_eof 1 \
-reconnect_streamed 1 \
-y \
-shortest \
-c: libx264 \
-crf:v 22 \
-preset:v fast \
-pix_fmt yuv420p \
-x264opts keyint=10:no-scenecut=1 \
-maxrate:v 256k \
-bufsize:v 512k \
-c:a aac \
-ac 2 \
-b:a 96k \
-maxrate:a 96k \
-bufsize:a 192k \
-f flv \
rtmp://destination_stream_ip:port
I've tried this as a batch command, but it also eventually gives up.
#!/bin/bash
while :
do
ffmpeg \
-i http://source_stream_ip:port \
-reconnect_at_eof 1 \
-reconnect_streamed 1 \
-y \
-shortest \
-c: libx264 \
-crf:v 22 \
-preset:v fast \
-pix_fmt yuv420p \
-x264opts keyint=10:no-scenecut=1 \
-maxrate:v 256k \
-bufsize:v 512k \
-c:a aac \
-ac 2 \
-b:a 96k \
-maxrate:a 96k \
-bufsize:a 192k \
-f flv \
rtmp://destination_stream_ip:port
done
Could anyone recommend an improvement to doing this or even another way of doing this even without ffmpeg by using another command line tool? At the moment it is too unreliable to use on a permanent basis.
Try to add:
-reconnect_on_network_error 1 -reconnect_on_http_error 1
The -reconnect_at_eof and -reconnect_streamed options should be put before -i SOURCE:
ffmpeg \
-reconnect_at_eof 1 \
-reconnect_streamed 1 \
-i http://source_stream_ip:port \
...
When I execute the ffmpeg command I get this error:
Unable to find a suitable output format for ffmpeg
String strCommand = "ffmpeg -loop 1 -t 3 -i " + list.get(0)" -loop 1 -t 3 -i " + list.get(1)+" -loop 1 -t 3 -i " + list.get(2)+" -loop 1 -t 3 -i " + list.get(3)+ " -filter_complex[0:v]trim=duration=3,fade=t=out:st=2.5:d=0.5[v0];[1:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v1];[2:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v2];[3:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v3];[v0][v1][v2][v3]concat=n=4:v=1:a=0,format=yuv420p[v] -map [v] -preset ultrafast " + getVideoFilePath();
You command seems to be ok, please be sure that getVideoFilePath() can get a right path with the supported format, for example, /path/.../slide.mp4, here is a workable example ffmpeg line:
ffmpeg \
-loop 1 -t 3 -i pic001.jpg \
-loop 1 -t 3 -i pic002.jpg \
-loop 1 -t 3 -i pic003.jpg \
-loop 1 -t 3 -i pic004.jpg \
-filter_complex "\
[0:v]trim=duration=3,fade=t=out:st=2.5:d=0.5[v0];\
[1:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v1];\
[2:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v2];\
[3:v]trim=duration=3,fade=t=in:st=0:d=0.5,fade=t=out:st=2.5:d=0.5[v3];\
[v0][v1][v2][v3]concat=n=4:v=1:a=0,format=yuv420p[v]" \
-map "[v]" -preset ultrafast slide.mp4
In Reference to https://superuser.com/questions/833232/create-video-with-5-images-with-fadein-out-effect-in-ffmpeg
I have a bunch of images. and I want to make a video using these images.
Below is my code for FFMpeg. But the problem is how can I append an audio file to -filter_complex (with bitrate)
ffmpeg \
-loop 1 -i input0.png \
-loop 1 -i input1.png \
-loop 1 -i input2.png \
-loop 1 -i input3.png \
-loop 1 -i input4.png \
-filter_complex \
"[0:v]trim=duration=15,fade=t=out:st=14.5:d=0.5[v0]; \
[1:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v1]; \
[2:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v2]; \
[3:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v3]; \
[4:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v4]; \
[v0][v1][v2][v3][v4]concat=n=5:v=1:a=0,format=yuv420p[v]" -map "[v]" out.mp4