A reasonable working hypothesis therefore is that you are limited by the computational throughput of the video encoders/decoders of the GPU. I assume your software uses NVENC, which is a separate hardware module unrelated to CUDA?
When this starts running, I initially get a speed of 1.5x/45 FPS. I assume that this reported speed is the rate at which ffmpeg is able to encode and send the output of raspivid. After this command has been running for a few minutes, the speed will (always) monotonically degrade until the FPS is less than the input (24), and the stream starts to lag. I have tried a number of changes to the command, including smaller video, lower frame-rate, lower quality, and even streaming to a local file instead of YouTube. The behaviour remains in all cases, and it seems as if ffmpeg itself is getting slower the longer it runs.
For reliable use of ffmpeg, there can be other streams in the input file, like m4a that has mjpeg icons (video), and other metadata that corrupts and wastes space, that must be not passed to the output.
Thanks.
But I have a qustion.
Can I use file size instead of time in this command?
Openai whisper limit the file size as 25MB, so I need to split the large audio file into chunk. In this way, if I can use file size value instead of time value, it would be great.
Please help me.
Due to the nature of the data (audio) it is more logical to split your file by time and there is no direct way using ffmpeg to do it. But by experience, the chunks output using the time approach has similar file size. So I would suggest that perhaps you can approximate how long can be fitted within 25MB of your data and just use it.
Over the years, there were many an occasion when I need to do some form of multimedia editing. Audio, video, you name it. Whether it's creating my unfunny clips for my Youtube channel, extracting or converting music, embedding subtitles, time and again, I would find myself using ffmpeg on the command-line and always enjoying the process while being ever so subtly amazed by this unassuming program's capabilities.
And so I thought, maybe I should write a more comprehensive guide on ffmpeg, one which lists the variety of tasks and functions, and then also wrap them around real-life examples and use cases. While I first mentioned ffmpeg in anger back in my Flash editing tutorial in 2008, it's time for a fresh, up-to-date article. It's going to be command-line, it's going to be nerdy, but it should also be fun. Follow me.
Ffmpeg is available in pretty much all and any Linux distribution, and there are also builds for Windows and Mac. If you want to know what it can do, you can check its capabilities by running ffmpeg without arguments or with an optional -hide_banner flag. You can also use the help option for the main program as well as any of its many sub-commands. The dazzling array of features can be intimidating, so we shall proceed slowly but surely. Then, don't forget the actual documentation, which is pretty neat.
One of the most common tasks is converting files from one format to another. Remember my example of how to extract audio files from an FLV clip? Same thing. But you may want to convert a video recorded on a camera to something like MP4, or maybe convert your OGG files to MP3, or similar. There's an endless variety of scenarios, and an equally endless number of supported modes and formats in ffmpeg. Typically, what you will do is:
This superb utility gives you a lot of flexibility in how you do things. For example, codec:v, vcodec and c:v are identical, and you can use any one you want. If you only want an audio output, like above, ffmpeg will guess and assume you also meant -vn. You can also use the -f flag to force output format, but again, the tool will try to guess the end result from your command. For instance, you could use -f mp3 or acodec mp3.
This is another useful scenario. If you have a very big clip, but you only need a few minutes or seconds, ffmpeg can cut out the necessary pieces. Likewise, you can combine multiple files into one stream - both video and audio. Ffmpeg lets you choose the desired start and end timestamps, so you have a lot of leeway in how you do handle the task.
Remember my VLC & subtitles article? Well, if you're not intimidated by the command line, you can do the same thing with ffmpeg. As a trivial example, say you have separate audio and subtitle files. Without any additional processing, you can just use the video filtering option for this:
This is another interesting usecase. Like any human being, you may want to take any video, speed it up 2x and then add Benny Hill music, and there should be much rejoicing. You could also slow down action, and then, to spice things up, also add smoothing so the slowed sequence does not feel stilted.
The video speed filter works by changing the presentation timestamp (PTS) of each video frame. Simply put, fractional values speed up the video, multipliers higher than 1 slow it down. When you speed it up, ffmpeg will drop frames, but you can specify a higher framerate. To preserve the original, you can multiply the FPS in your input by the 1/PTS you're using. So if you double the speed of your 24FPS clip, you should use 48FPS rate.
Smoothing videos is more complicated. I did have to consult the documentation. Essentially, for a video that's slowed down 5 times (and 5 times longer than the original), I'm using video interpolation to create the smoothing effect. Here, too, you need to add FPS, so that ffmpeg has sufficient data to guess the frames in between. In my example, 5x slowed down, you need 5x24 FPS (original speed), ergo 120 FPS.
For audio, you can use atempo. This option has a range of 0.5-2.0, which means half or double the speed at most, however, it is possible to chain multiple atempo filters to get additional speed changes. Something like the example below:
Anyway, we talked about conversion and transcoding, scaling and quality, image extraction, combination and GIF creation, splitting and joining of videos, subtitle extraction and embedding, video speedup and slowdown, and then some. That should keep you happy and busy for a while. If you have any ffmpeg-related requests or questions, fire away, the email is only a click away. Or something. Finally, if this tutorial was truly useful, do give some love back, because why not.
ffmpeg -i 1080p-input.mp4 -c:v libx264 -s 1280x720 -preset medium -g 60 -keyint_min 60 -sc_threshold 0 -bf 3 -b_strategy 2 -b:v 1500k -maxrate 1650k -bufsize 1500k -c:a aac -b:a 64k -ac 1 -ar 44100 -pass 2 720p_output.mp4
To bring this home let us take a look at what happens when you use the proper two pass log files versus what happens when you use the wrong ones. In this instance the source content was 1080p and was used to generate the ffmpeg2pass-0.log.mbtree file and the ffmpeg2pass-0.log file. A second two pass encode was used to create a 480p output from the same 1080p source just like you would do when creating ABR content.
Take note that a lot of data was pulled out of the I frames and allocated to P and B frames when the 1080p ffmpeg2pass-0.log.mbtree file and the ffmpeg2pass-0.log file were used instead of the ones that were generated for the output 480p content. This lowered SSIM quality to an average of 0.97553 when using the wrong two pass files. Viewing some of the frame differences in MSU VQMT made my eyes hurt.
Generally speaking I limit reference frames to three for compatibility purposes. If you decide to go above that make sure that you research which device or devices support larger reference frame distances. Note that using the animation tuning option for x264 will double your reference frames unless it is set to one[9].
If any of the encoding parameters between outputs is different then you should not use the first pass analysis file from that encode. This includes, but is not limited to, different resolutions, bitrates, presets, profiles, and tuning options.
The AAC encoder in Shotcut seems to be very inefficient and sounds really bad at bitrates like 192kbit/s which is no issue for the Vegas AAC codec. Open Source encoders like NeroAAC are probably a good choice. And since I am muxing 23,976fps videos with PAL from a 25fps source, it would be very nice to have a option to change the FPS of a video which then affects the speed of the playback. I know this can take some time, but these are features I love in Vegas which I would love to see in Shotcut since Vegas has color problems which limit my workflow there (colors are just wrong no matter what I do)
This is a late reply and question but is it possible to use the FDK AAC codec? I guess it is included in the Ffmpeg library already. _aac
It can be built in to ffmpeg manually as far as I know, would it be likely to see a high quality option in the future?
As of now, WebAssembly is still a lot slower than native, it is possible to further speed up usingWebAssembly intrinsic, which is basically writing assembly code. It is something we are investigatingand hope to introduce in the future.
@ffmpeg/core contains WebAssembly code which is transpiled from original FFmpeg C code with minor modifications, but overall it still following the same licenses as FFmpeg and its external libraries (as each external libraries might have its own license).
Hi I am having an issue with playback on my Chromecast with Google TV. when I play something with playback set to auto it will top out the playback at 40.2Mbs if the movie is encoded above that then it will transcode. I have a download speed to the Google TV of 129Mbs so can't understand why Emby will not go above 41Mbs?. I have Emby installed on my LG TV and it will stream anything without transcoding or have any issues with playback. I have tried setting the playback on the Google TV to various speeds without any success. I have attached logs from playback set at 100Mbs and at auto. Also the same movie played back on the LG TV for comparison. Any help appreciated.
760c119bf3