FFMpeg rtsp to m3u8 - ffmpeg

I am using FFMPeg (version ffmpeg-20170330-ad7aff0-win64-static) to convert RTSP to .m3u8.
The command is:
ffmpeg -rtsp_transport tcp -i {RTSP} -c:v libx264 -crf 35 -preset ultrafast -maxrate 3M -bufsize 300k -r 10 -g 20 -movflags +faststart -tune zerolatency -hls_time 1 -hls_list_size 4 -hls_wrap 4 -start_number 1 -hls_allow_cache 0 -threads 1 -loglevel warning -y {PLAYLISTM3U8LOCATION]
I am getting following warning constantly:
Duplicated segment filename detected: playlist1.ts
or
Duplicated segment filename detected: playlist2.ts
or
Duplicated segment filename detected: playlist3.ts
In between its also showing warning:
cseq 10 expected, 8 received
any help on this??

I have met with a problem like so.My solution is to set the hls_wraps value larger than the hls_list_sizes.Maybe it can help you.

Related

ffmpeg best settings for youtube live

I have this settings for ffmpeg
ffmpeg -f lavfi -i anullsrc -rtsp_transport tcp -i "rtsp://" -c:v libx264 -b:a 384k -ac 2 -preset slow -crf 18 -profile:v high -bf 2 -pix_fmt yuv420p -movflags +faststart -threads 4 -cpu-used 0 -b:v 5M -r 30 -g 15 -coder 1 -f flv rtmp://a.rtmp.youtube.com/live2/
but the quality and speed is not very good,
could some one tell me what at the best settings
thanks

ffmpeg: create slideshow of unknown number of images with transition

hope someone could help me with this. Kinda new with ffmpeg and a bit stumped.
Given an input of a set of numbered images in a folder, I want to generate a video with each image shown for 60 seconds. I would love to use a default transition between each images.
The following code, correctly generates an mp4 without transitions:
ffmpeg -framerate 1/60 -pattern_type glob -i "*.png" -vcodec libx264 \
-pix_fmt yuv420p -r 30 -threads 4 -crf 25 -refs 1 -bf 0 -coder 0 -g 25 \
-keyint_min 15 -movflags +faststart no_audio_output.mp4
But when I try to add a default transition (supported in the version of ffmpeg I'm using that is the 5.1):
ffmpeg -framerate 1/60 -pattern_type glob -i "WC*.png" -filter_complex
xfade=transition=circleopen:duration=5:offset=55 -vcodec libx264 \
-pix_fmt yuv420p -r 30 -threads 4 -crf 25 -refs 1 -bf 0 -coder 0 -g 25 \
-keyint_min 15 -movflags +faststart no_audio_output.mp4
I have as error:
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_xfade_0
I googled a lot but still the solution is unclear. All the examples I found have been designed to deal with a slideshow/input with a define number of pieces while in my case the folder could contain any number of images.
Thanks all for your help!

ffmpeg streaming lag cut pause, when I change crf qmin refs, etc, the lag remains

The question is about tuning a FFMPEG command, not about the context or the use, my setup works, it's only the lag part I'm trying to get smoother....
here the ffmpeg command
ffmpeg -y -f alsa -i pulse -f x11grab -draw_mouse 0
-framerate $FRAMERATE -video_size $RESOLUTION -i :$DISPLAY_NUM
-c:v libx264
-movflags +dash
-preset ultrafast
-crf 27 -refs 4 -qmin 4
-pix_fmt yuv420p
-c:a aac -ac 2
-profile:v baseline
-hls_time 6 -hls_list_size 0 -g 30
-start_number 0 -streaming 1 -hls_playlist 1 -lhls 1
-f hls -filter:v fps=$FRAMERATE x.m3u8
I tried changing values in preset, crf, refs, qmin, qmax, profile:v, hls_time......
no matter what I change doesn't fix the "lag" or feeling that it pause,
sample here : https://www.tubfeed.com/_/tubfeed/---/multishare/multimedia/16607032261648
is there any ffmpeg option or attribute that I missed to try ??
After digging a bit I found more flags for low_delay...
I did this and the lag disappeared
ffmpeg -y
-f alsa -thread_queue_size 4096
-i pulse -f x11grab -thread_queue_size 4096
-draw_mouse 0 -framerate $FRAMERATE
-video_size $RESOLUTION
-i :$DISPLAY_NUM
-c:v libx264
-movflags +dash
-fflags nobuffer
-flags low_delay
-threads 2
-preset ultrafast
-tune zerolatency
-crf 27 -refs 4 -qmin 4
-pix_fmt yuv420p
-c:a aac -ac 2
-profile:v baseline
-hls_time 6 -hls_list_size 0 -start_number 0
-streaming 1 -hls_playlist 1 -lhls 1
-f hls -filter:v fps=$FRAMERATE "/recordings/$VIDEO_ID/$VIDEO_NAME.m3u8"

FFMPEG: Encoding WEBM with fast-seek and copyts leads to wrong video length

I'm trying to convert a scene from a soft-subbed MKV file into a hard-subbed WEBM file with two-pass. The video encodes fine, but the file shows the wrong length when opened on a media player (it's showing as if I had encoded the original file from the starting point all the way to the end).
This is the command I'm using:
set timestamp=-ss 12:59.069 -to 16:14.277
ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 1 -b:v 0 -crf 33 -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -an -sn -vf scale=-1:720,subtitles=source.mkv -f webm NUL
ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 33 -threads 8 -speed 2 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -sn -vf scale=-1:720,subtitles=source.mkv -f webm out.webm
When opening the video in MPC-BE, the video plays regularly until around the point shown on https://i.stack.imgur.com/6bRwc.png (which is where the scene I wanted to cut out ends) then it just skips to the end of the file, and this wrong length is giving me all sorts of issues when I try to use the encoded video.
Apparently, your player doesn't like a non-zero starting timestamp (at least in WebMs).
So, reset the timestamps before writing (I assume you're using copyts for the subtitles filter alignment).
In pass 2,
ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 33 -threads 8 -speed 2 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -sn -vf scale=-1:720,subtitles=source.mkv -output_ts_offset -12:59.069 -f webm out.web
where the value for ts offset is the negative of your ss value.

FFMPEG - Using multiple Fiters including hardsub, denoise, watermark causes "Too many inputs" Error

I'm trying to do one command with complex filters that allow for denoising, hardsub, scaling (to 480 height) and watermark.
I've gotten 3/4 filters to work in combination with each other here:
ffmpeg -i test720.mp4 -vf hqdn3d=1.5:1.5:6:6,scale=w="if(gt(dar\,854/480)\,min(854\,iw*sar)\,2*trunc(iw*sar*oh/ih/2))":h="if(gt(dar\,854/480)\,2*trunc(ih*ow/iw/sar/2)\,min(480\,ih))"\:flags=bicubic,setsar=1\,subtitles=add.ass[out]" -c:v libx264 -crf 18 -preset veryslow -tune film -refs 8 -bf 6 -aq-mode 2 -c:a copy -f mp4 720encoded.mp4
but when it comes to all for, it gives me a Too many inputs specified for the "movie" filter.
Here is my command that should work but doesn't :
ffmpeg -i test720.mp4 -vf hqdn3d=1.5:1.5:6:6,scale=w="if(gt(dar\,854/480)\,min(854\,iw*sar)\,2*trunc(iw*sar*oh/ih/2))":h="if(gt(dar\,854/480)\,2*trunc(ih*ow/iw/sar/2)\,min(480\,ih))"\:flags=bicubic,setsar=1\,"movie=actorimage.png[wm];[in][wm]overlay=30:main_h-overlay_h-120\,subtitles=add.ass[out]" -c:v libx264 -crf 18 -preset veryslow -tune film -refs 8 -bf 6 -aq-mode 2 -c:a copy -f mp4 720encoded.mp4
I'm sure I'm making a simply syntax error somewhere in there.
Final working script: ffmpeg -i test720.mp4 -filter_complex "hqdn3d=1.5:1.5:6:6,scale=w=if(gt(dar\,854/480)\,min(854\,iw‌​sar)\,2*trunc(iwsaro‌​h/ih/2)):h=if(gt(dar‌​\,854/480)\,2*trunc(‌​ihow/iw/sar/2)\,min(‌​480\,ih)):flags=bicu‌​bic,setsar=1[we];mov‌​ie=actorimage.png[wm‌​];[we][wm]overlay=30‌​:main_h-overlay_h-12‌​0,subtitles=add.ass" -c:v libx264 -crf 18 -preset veryslow -tune film -refs 8 -bf 6 -aq-mode 2 -c:a copy -f mp4 720.mp4

Resources