ffmpeg how to capture lower resolution video from a multi resolution stream resource

Guys, I used to capture a live video stream from a website. Recently this website updated their video to 4K available, thus there would be 4k, 2k, 1080p and 720p video stream to choice. While I use ffmpeg to record those videos, it always catch the highest resolution stream. It was fine when the highest resolution is 1080p only. After updated, I can capture 4k stream only as my resource, that cause my problem because my internet bandwidth is limited, there are too many segment (frames) lost during the recording, and I got failure notice eventually. I used a only simple ffmpeg command at win10 Command Prompt as: ffmpeg -i “https://website address/playlist.m3u8” -codec copy output.mp4 How can I capture the 1080p stream instead of 4k stream by ffmpeg?

ffmpeg loop audio over rtmp stream

How can I loop audio.mp3 as background audio of an rtmp stream?

I’m can stream a webcam (just video) to rtmp with like this…

ffmpeg -f v4l2 -codec:v h264 -framerate 24 -video_size 1920x1080 -i /dev/video0 -codec:v copy -f flv rtmp://x.rtmp.youtube.com/streamkey 

…however, the stream is completely silent. I can add background audio from an .mp3 file but when the audio track ends the stream continues in silence.

ffmpeg -i /home/pi/audio.mp3 -codec:a libvorbis -f v4l2 -codec:v h264 -framerate 24 -video_size 1280x720 -i /dev/video0 -codec:v copy -g 24 -keyint_min 12 -f flv rtmp://x.rtmp.youtube.com/streamkey 

I want the audio to loop continuously in the background for as long as the stream lasts. The ffmpeg docs mention a stream_loop option to Set number of times input stream shall be looped this sounds promising but I can’t figure out how to implement!

When I combine two video using ffmpeg with C# then Duration is greater then addition of both video’s duration?

I have two file one has video length is 00:02:18 and second videos duration is 00:01:25 then I combined both video using ffmpeg command in c# then after combine video’s length should be 00:03:43 but when I see the output video’s length is 00:04:03. I can not figure out why this happen.

ConvertCommand = String.Format($  @"-y -safe 0 -f concat -i ""{CombineTextList}"" -fflags +genpts ""{CombinedVideo}""", CombineTextList, CombinedVideo); 

I am using this ffmpeg command for combining video.

  1. CombineTextList is path of the text file which has the path of inputfile.
  2. CombinedVideo is the path of output file.
  3. ConvertCommand is for FFMPEG command.

    CombineTextList :

file ‘C:\Users….mp4 file ‘C:\Users….mp4

Note: I am using ffmpeg in c# windows form application.

Is there any way to convert a bunch of .ogg files in a folder to .mp3 using ffmpeg? [duplicate]

This question already has an answer here:

  • Suggestions for a batch audio converter? 1 answer

Is there any way to convert a whole heap of .ogg files in about 30 folders in a folder containing those folders to .mp3 files and put them in another folder using the command ffmpeg? The previous methods I have tried all led to the same error: “*.ogg no such file or directory”

If possible could you please tell me how? I cant find anything relating to this specific question.

Security risks of using ffmpeg as part of web service

I’m working on a web service that uses ffmpeg on the backend for processing user uploaded media files. I’m giving the users some options to customize how their videos are processed, which is essentially parameterizing the ffmpeg command.

I’m planning to run ffmpeg in a dockerized environment, possibly with a new docker container per execution. Regardless, this environment could be used to execute arbitrary code and might have have access to some of my secrets.

Beyond command-line injection, are there any other security concerns to consider here?

ffmpeg: how to include a later starting dvb-subtitle stream?

$   ffmpeg -i fa1.m2t -ss 0:02:22 -to 01:34:17 -map 0:1 -map 0:2 -map 0:6? -c:v libx265 -crf 28 -preset ultrafast -c:a aac -b:a 128k -c:s copy fa1.mkv 

The streams are:

Input #0, mpegts, from ‘fa1.m2t’: Duration: 01:43:54.32, start: 40328.578578, bitrate: 5611 kb/s Program 25 Stream #0:00×33: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006) Stream #0:1[0x13a]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920×1080 [SAR 1:1 DAR 16:9], Closed Captions, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:20×366: Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s Stream #0:30×369: Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s (visual impaired) Stream #0:40xc38: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Stream #0:50xc4f: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired) File ‘fa1.mkv’ already exists. Overwrite ? [y/N] y

But the the subtitle stream that I want is #0:6 which starts later…

Output #0, matroska, to ‘fa1.mkv’: Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: hevc (libx265), yuv420p, 1920×1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 25 tbc Metadata: encoder : Lavc57.107.100 libx265 Stream #0:1(swe): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc57.107.100 aac [mpegts @ 0x561dd54e9ae0] New subtitle stream 0:6 at pos:100252692 and DTS:40471.3s
frame= 638 fps= 28 q=-0.0 Lsize= 3587kB time=00:00:25.40 bitrate=1156.9kbits/s speed=1.11x

So, how can I include this stream #0:6 into the movie? It does not exist in the beginning of the recording.

re-write certain part of .mp4 file using ffmpeg

How do i update existing .mp4 file using ffmpeg (or any other tool for that matter)

I want to overwrite one minute of video from 30:09 (mins:sec) to 31:09 using another video of one minute.

Is there any ways to achieve WITHOUT creating a new temporary file? Basically would like to update existing file directly to save time that it takes in creating new file and overwriting the original file.

Thanks for your help.

How to create slideshow with FFMPEG with exact times of the slides

I create a slideshow as

ffmpeg \ -loop 1 -t 5 -i input0.png \ -loop 1 -t 5 -i input1.png \ -loop 1 -t 5 -i input2.png \ -loop 1 -t 5 -i input3.png \ -loop 1 -t 5 -i input4.png \              -i audio.mp3 \ -filter_complex \ "[0:v]fade=t=out:st=4:d=1[v0]; \  [1:v]fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v1]; \  [2:v]fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v2]; \  [3:v]fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v3]; \  [4:v]fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v4]; \  [v0][v1][v2][v3][v4]concat=n=5:v=1:a=0,format=yuv420p[v]" -map "[v]" -map 5:a out.mp4 

How can I modify the code with exact start and end time of each slide instead of duration.

Windows treats m3u8 link parameters as CMD command from ffmpeg command

I am trying to download m3u8 file using ffmpeg, it was working perfectly until few days ago, it started to behave strangely.

first let me write down how command looks like:

ffmpeg -i https://LINK.TO/FILE.m3u8?Policy=eyQ__&Signature=eFI5zA__&Key-Pair-Id=APKAJMWS -c copy -bsf:a aac_adtstoasc output.mp4 pause 

As you can see the link is for m3u8 file, with three parameters, they are Policy, Signature and Key-Pair-Id.

the expected result must be an mp4 file named output.mp4, but what I see is bunch of error messages, then CMD window closes, This is the error messages:

'Signature' is not recognized as an internal or external command, operable program or batch file. 'Key-Pair-Id' is not recognized as an internal or external command, operable program or batch file. 

Why does Windows treat them as commands?

you can see clearly that they are just parameters!