Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Thread count option in FFmpeg for FASTEST conversion to h264 ?
9 février, par S BI need to maximize speed while converting videos using FFmpeg to h264
- Any input format of source videos
- User's machine can have any number of cores
- Power and memory consumption are non-issues
Of course, there are a whole bunch of options that can be tweaked but this question is particularly about choosing the best
-thread
option. I am trying to find an ideal thread count as a function of- no. of cores
- input video format
- h264-friendly values maybe?
- anything else missed above?
I am aware the default
-thread 0
follows one-thread-per-core approach which is supposed to be optimal. But I am not sure if this is time or space-optimized. Also, on certain testcases, I've seen more threads (say 4 threads on my dual core test machine) finishes quicker than the default.Any other direction, say configure options w.r.t. threads, worth pursuing?
-
RTSP Client for H264 Audio/Video Stream
9 février, par Jean-Philippe EncausseI'm looking for a simple way to get data of an IP Camera RTSP Stream (using H264 Audio/Video) and get on the other side
- a frame by frame byte[]
- a stream of the audio
After many research
- EmguCV Capture seems hanging forever (no answer from forum)
- There is many (too big) RTSP Server few decode H264
- There is "slow" ffmpeg wrapper
- There is some managed DirectShow wrapper
So I don't know where to go ? And how to do this ?
It seems iSpyCamera is doing the job but it's a big project not a little library to query ip cameras.
-
How to remove a specific segment from an audio file using timestamps ? [closed]
9 février, par Hilal KhanI am working on a C# project where I need to remove a specific segment from an audio file (e.g., WAV, MP3) based on start and end timestamps, while keeping the rest of the audio intact.
For example, given a 20-minute audio file, I want to remove the section from 17:00 to 19:00 and be left with a new audio file containing only 0:00-17:00 and 19:00-20:00 (i.e., keeping the parts before and after the cut).
I have used NAudio and FFmpeg to trim a file by cutting from the start or end, but I only get my desired snippet as a separate file which is not what I am looking for as I want it to be removed from the audio itself
Heres what I have so far:
static void RemoveSegment(string inputPath, string outputPath, double startTime, double endTime) { using (var reader = new Mp3FileReader(inputPath)) { var writer = new FileStream(outputPath, FileMode.Create, FileAccess.Write); int bytesPerMillisecond = reader.WaveFormat.AverageBytesPerSecond / 1000; long startPosition = (long)(startTime * 1000) * bytesPerMillisecond; long endPosition = (long)(endTime * 1000) * bytesPerMillisecond; byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = reader.Read(buffer, 0, buffer.Length)) > 0) { if (reader.Position < startPosition || reader.Position > endPosition) { writer.Write(buffer, 0, bytesRead); } } writer.Close(); } Console.WriteLine("Segment removed successfully!"); }
-
ffmpeg change framerate : Question about bitrate [closed]
9 février, par schweigersonThanks to the forum, I successfully can reduce the frame rate of a video.
ffmpeg -i input_50fps.mp4 -filter:v fps=25 output_25fps.mp4
Input and output have a similar bitrate as well as filzesize:
File bitrate filesize input_50fps.mp4 2900kBit/s 1.9GB output_25fps.mp4 2528kBit/s 1.7GB Assumption: Divide the number of frames into half should both reduce the bitrate and the filesize accordingly (half the size).
Question: Does it make sense to enforce the reduction of the bitrate to approx. half the original one, when I reduce the framerate by to 50% (e.g. with
-b:v 1500k
)? IMHO, the video quality should be comparable to the original video then.Note: I may make according test runs, but I perhaps do not have the ability to recognize the quality difference as I'm not an advanced video expert.
Would be happy to read your advice.
-
Play video with multiple audio tracks - different languages to separate devices
8 février, par SandreI want watch movie with my wife, listening to different audio channels - one language for me, another for my wife.
I found solution and it works fine but not optimal.
I know nothing about audio conversion, so asking to make it better.
I'm using ffmpeg to combine separate stereo tracks to 5.1, then playing using IINA to Agregate device defined in Audio MIDI Setup (Speakers and bluetooth headphone). This for MacOS, but I'm pretty sure something similar will work for windows, taking in count IINA under hood use MPV.
ffmpeg -i eng.mp3 -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" -map "[left]" en_left.wav -map "[right]" en_right.wav ffmpeg -i ru.ac3 -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" -map "[left]" ru_left.wav -map "[right]" ru_right.wav ffmpeg -i ru_left.wav -i ru_right.wav -i ru_left.wav -i ru_right.wav -i en_left.wav -i en_right.wav \ -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]join=inputs=6:channel_layout=5.1[a]" -map "[a]" output.wav
What I want to improve:
- I added 2 useless channels (2 and 3) - just a copy of 1 and 2.
- All tracks converted - probably it's possible just copy them?
- Would be good to have possibility extract channels embedded into video.