I have a m3u8 input and I convert it to a rmtp stream using this command:
ffmpeg -re -i "https://<url>.m3u8" -af asetpts=N/SR/TB -c:v copy -c:a aac -ar 44100 -ab 128k -ac 2 -f flv -flvflags no_duration_filesize -s 1920x1080 "rtmp://<url>"
But I would like to add my logo on the top right part of the stream, I didn't manage to do it, do someone know how to do it?
Thanks
Related
I tried to stream an mp3 file to a Telegram RTMP live using the following command:
ffmpeg -re -i 1.mp3 -c copy -f mp3 rtmps://dc4-1.rtmp.t.me/s/145158:AtyF3rrME2nHEkqGA
But I couldn't hear any sound in the stream.
You should specify the codecs explicitly.
The following is the simplest working command:
ffmpeg -i your_input -c:v libx264 -c:a aac -f flv rtmps://dcx-y.rtmp.t.me/s/YOUR_KEY
Here is a more advanced example from #tgbeta:
ffmpeg -stream_loop -1 -re -i your_input -c:v libx264 -preset veryfast -b:v 3500k -maxrate 3500k -bufsize 7000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmps://dcx-y.rtmp.t.me/s/YOUR_KEY
Change -f mp3 by -f flv.
Example:
ffmpeg -re -i 1.mp3 -c:a copy -f flv rtmps://dc4-1.rtmp.t.me/s/145158:AtyF3rrME2nHEkqGA
I am trying to combine files img1.png and video1.ts into a single movie. Everything works correct except audio: if first file in the movie is img1.png - there is no audio for video.ts. If first file is video1.ts - everything works as expected.
What I do:
1) create a video file fom img1.png:
ffmpeg -loop 1 -i img1.png -c:v libx264 -t 30 -pix_fmt yuv420p img.ts
2) concatenation:
ffmpeg -i "concat:img.ts|video1.ts" -c copy -bsf:a aac_adtstoasc res.mp4
What should I do to save audio for video1.ts ?
Thanks in advance!
You'll need to add a dummy audio stream with the same properties as the audio stream in the video file.
So, if the main audio is AAC, stereo, 44100 Hz, you would use
ffmpeg -loop 1 -i img1.png -f lavfi -i anullsrc -pix_fmt yuv420p -c:v libx264 -c:a aac -ar 44100 -ac 2 -t 30 img.ts
I'm looking for a way to add an audio watermark, on specific time, to a video file (with existing audio) . something like: ffmpeg -i mainAVfile.mov -i audioWM.wav -filter_complex "[0:a][1:a] amix=inputs=2:enable='between(t,9,10)' [aud]; [0:v][aud]" -c:v libx264 -vf "scale=1280:720:sws_dither=ed:flags=lanczos, setdar=16:9" -c:a libfdk_aac -ac 2 -ab 96k -ar 48000 -af "aformat=channel_layouts=stereo, aresample=async=1000" -threads 0 -y output.mp4
The above command gives me this error Timeline ('enable' option) not supported with filter 'amix'. amerge didn't work as well. I kind of get lost with filter_complex syntax, specifically with the following conditions
On the main AV file, both audio and video tracks are filtered
Watermark should be between the 9th and 10th second (I already
generated a 1 second, 10k tone file)
The watermark need to survive the proceeding audio transcode
Use
ffmpeg -i mainAVfile.mov -i audioWM.wav
-filter_complex
"[0:a]aformat=channel_layouts=stereo,aresample=async=1000[main];
[1:a]atrim=0:1,adelay=9000|9000[wm];[main][wm]amix=inputs=2"
-vf "scale=1280:720:sws_dither=ed:flags=lanczos,setdar=16:9" -c:v libx264
-c:a libfdk_aac -ac 2 -ar 48000 -b:a 96k
-threads 0 -y output.mp4
It's preferable to perform all filtering in a single filtergraph. But I've kept the video filter as-is.
Im trying to create an mp4 video from an mp3 and an image with ffmpeg. The video should be the size of 640x360 with black background and the image should be resized to fit in this dimensions and centred in the middle. The video's length must match the mp3's length.
Its basically a video creation for youtube from a song and an artwork.
For now i was able to achieve this with 3 steps:
resize image:
-i %image% -vf scale='if(gt(a,4/3),640,-1)':'if(gt(a,4/3),-1,360)' %resized_image%
create a music video with black background:
-f lavfi -i color=s=640x360 -i %audio_file% -c:v libx264 -s:v 640x360 -c:a aac -strict experimental -b:a 320k -shortest -pix_fmt yuv420p %video%
put the resized image centred in the video:
-i %video% -i %resized_image% -filter_complex "overlay=(W-w)/2:(H-h)/2" -codec:a copy %final_video%
Is it possible to achieve all this with one ffmpeg command ?
Single command would be
ffmpeg -loop 1 -i image -i audio
-vf scale='if(gt(a,4/3),640,-1)':'if(gt(a,4/3),-1,360)',pad=640:360:(ow-iw)/2:(oh-ih)/2,format=yuv420p
-c:v libx264 -c:a aac -b:a 320k -strict -2 -shortest final.mp4
I need to create a FLV video from a MP3 file and a PNG image, and I tried the following ffmpeg command:
/usr/bin/ffmpeg -y -i file.png -i file.mp3 -acodec libmp3lame -vcodec flv -y -ac 1 -ab 32000 -ar 22050 file.flv
I obtained a FLV video file with the correct audio and the image, but it is not seekable in VLC, so I'm looking where I'm wrong.
Could you help me, please?
Thank you very much!