Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg scale image with unrelated number in the name
15 juin 2016, par loctriceI'm attempting to scale image(s) that have any given name. I've found my script is failing on files that have numbers in the name. "0% financing", "24 Hour", etc. The other files are working fine, so it's not the script itself. I get:
[image2 @ 0x7fbce2008000] Could find no file with path '/path/to/0% image.jpeg' and index in the range 0-4
How can I tell ffmpeg that this isn't a search pattern, or sequential numbered files ? There's only 1 jpeg in each location, and I do not have control of the file names to change them.
-update- I've figured out the command
ffmpeg -pattern_type none -i /path/to/0%\ image/0%\ image.jpeg -vf scale=320:-1 /path/to/0%\ image/0%\ image.out.jpeg
gets me past the initial problem, but the output won't work because I can't get it now to escape the final argument. If I am in the directory (so no path) and change the output to just out.jpeg it will work, so I'm confident the first error is corrected.
Now I need to figure out how to use spaces in the path in the output argument? I've tried surrounding it in quotes:
"0% image.out.jpeg"
regular escapes:
0%\ image.out.jpeg
and surrounding it in quotes and using escapes at the same time:
"0%\ image.out.jpeg"
-
FFmpeg not copying all audio streams
15 juin 2016, par user2513268I'm having trouble getting ffmpeg to copy all audio streams from a .mp4 file. After hours of searching online, it appears this should copy all streams (as shown in example 4 here):
ffmpeg -i in.mp4 -map 0 -c copy out.mp4
in.mp4
contains 3 streams:- Video
- Audio track 1
- Audio track 2
out.mp4
(which should be identical toin.mp4
) contains only 2 streams:- Video
- Audio track 1
FFmpeg does appear to correctly identify all 3 streams, but doesn't copy all of them over. Output from FFmpeg:
Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy)
Edit: Output from
ffmpeg -v 9 -loglevel 99 -i in.mp4
:Input #0, mov,mp4,m4a,3gp,3g2,mj2, from in.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.36.100 Duration: 00:00:06.03, start: 0.000000, bitrate: 5582 kb/s Stream #0:0(und), 1, 1/15360: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown, left), 1920x1080 (0x0) [SAR 1: 1 DAR 16:9], 0/1, 5317 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:2(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s Metadata: handler_name : SoundHandler Successfully opened the file. At least one output file must be specified [AVIOContext @ 0000000001c2b9e0] Statistics: 153350 bytes read, 2 seeks
Edit 2 (solved): I managed to find the correct syntax from this ticket. For any others that are interested, the correct syntax is:
ffmpeg -i in.mp4 -vcodec copy -c:a copy -map 0 out.mp4
This will copy all streams.
-
ffmpeg : combine two or three audios into one by lowering the volume of the other
15 juin 2016, par somya bhargavaWant to combine some audio files eg:
1) one long audio file which will act as a background audio 2) some audio files which will be replaced at specific intervals like at 10 sec of the first one
So final output required is audio-1 60 sec audio-2 starting from 10 sec to 20 sec with audio-1 at 0.1 volume
-
Mix PCM data from two decoded FFmpeg AVFrame* objects
15 juin 2016, par williamtroupI'm currently using the FFMpeg AutoGen project (in C# of course) to decode frames from an audio file and add them to a new stream that is being written to a video. This all works correctly, but I was wondering how one would go about mixing two AVFrame* objects together (after they are decoded).
I've mixed PCM data before, but was wondering if FFmpeg had a built in API to do the work more effectively.
This is how I'm currently doing it:
short* baseFrameBuffer1 = (short*)baseFrame->data_0; short* baseFrameBuffer2 = (short*)baseFrame->data_1; short* readFrameBuffer1 = (short*)readFrame->data_0; short* readFrameBuffer2 = (short*)readFrame->data_1; for (int frameIndex = 0; frameIndex< 1024; frameIndex++) { int dataSample1 = GetInRangeSample(baseFrameBuffer1[frameIndex] + readFrameBuffer1[frameIndex]); int dataSample2 = GetInRangeSample(baseFrameBuffer2[frameIndex] + readFrameBuffer2[frameIndex]); baseFrame->data_0[frameIndex] = (byte)dataSample1; baseFrame->data_1[frameIndex] = (byte)dataSample2; } private static int GetInRangeSample(int sample) { if (sample > short.MaxValue) { sample = short.MaxValue; } if (sample < short.MinValue) { sample = short.MinValue; } return sample; }
-
HLS folder is not getting created in NGINX-RTMP
15 juin 2016, par Sai KrishnaThis is my nginx configuration file. I am using OBS to stream some media files to my nginx server. The /tmp/live/ folder is getting created but /tmp/live/1080/index.m3u8 is not getting created.
https://gist.github.com/Eta-Meson/2f88a91ad57704247dcc5c9cf4a89e35
I have kept my configuration file in this gist.