Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Using ffmpeg with C++ : Undefined symbols for architecture x86_64
31 mars 2017, par JavaRunnerI'm dealing with one example of FFMPEG called is "muxing.c".
So I tried to compile that file with two Makefiles. The first one is for C-language:
FFMPEG_LIBS= libavdevice \ libavformat \ libavfilter \ libavcodec \ libswresample \ libswscale \ libavutil \ CFLAGS := -Wall -g $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS) LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) -lm $(LDLIBS) SOURCES= muxing \ OBJS=$(addsuffix .o,$(SOURCES)) all: $(OBJS) $(SOURCES)
That makefile compiles well. But if I trying to move this code to C++: I rename muxing.c to muxing.cpp and use this Makefile:
CC=g++ FFMPEG_LIBS= libavdevice \ libavformat \ libavfilter \ libavcodec \ libswresample \ libswscale \ libavutil \ CPPFLAGS := -Wall -g $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CPPFLAGS) LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) -lm $(LDLIBS) SOURCES= muxing \ OBJS=$(addsuffix .o,$(SOURCES)) all: $(OBJS) $(SOURCES)
I get a bunch of error like this:
$ g++ muxing.o -L/usr/local/Cellar/ffmpeg/3.2.4/lib -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lm -o muxing Undefined symbols for architecture x86_64: "av_dict_set(AVDictionary**, char const*, char const*, int)", referenced from: _main in muxing.o "av_strerror(int, char*, unsigned long)", referenced from: av_make_error_string(char*, unsigned long, int) in muxing.o "avio_closep(AVIOContext**)", referenced from: _main in muxing.o "swr_convert(SwrContext*, unsigned char**, int, unsigned char const**, int)", referenced from: write_audio_frame(AVFormatContext*, OutputStream*) in muxing.o "av_dict_copy(AVDictionary**, AVDictionary const*, int)", referenced from: open_video(AVFormatContext*, AVCodec*, OutputStream*, AVDictionary*) in muxing.o open_audio(AVFormatContext*, AVCodec*, OutputStream*, AVDictionary*) in muxing.o "av_dict_free(AVDictionary**)", referenced from: open_video(AVFormatContext*, AVCodec*, OutputStream*, AVDictionary*) in muxing.o open_audio(AVFormatContext*, AVCodec*, OutputStream*, AVDictionary*) in muxing.o "av_rescale_q(long long, AVRational, AVRational)", referenced from: write_audio_frame(AVFormatContext*, OutputStream*) in muxing.o "av_compare_ts(long long, AVRational, long long, AVRational)", referenced from: _main in muxing.o get_video_frame(OutputStream*) in muxing.o get_audio_frame(OutputStream*) in muxing.o
Is that mean those libs are not ready to work with x64? I strongly need to mix that code (muxing.c) with my C++ code because I have to render a video on the fly using ImageMagick (my code was written with C++) for the frames.
How can I mix C++ and C in this case?
My env is: OS X 10.12.3
-
ffmpeg clip audio interval with starting and end time
31 mars 2017, par Raymond HuangI am trying to clip an MP3 between two starting points, like starting at 10 seconds and ending at 16 seconds (time interval of 6 seconds).
I am using this command:
ffmpeg -ss 10 -i input.mp3 -t 6 output.mp3
The resulting
output.mp3
contains the 6 seconds that I specified followed by 8 or 9 seconds of empty audio. Is there something wrong with my command?Edit:
ffmpeg -ss 10 -t 6 -i input.mp3 output.mp3
says-t is not an input option, keeping it for the next output; consider fixing your command line.
and gives me a file that's got 8 seconds of audio starting from 10s and then some 9 or 10 seconds of silence.ffmpeg -ss 10 -to 16 -i input.mp3 output.mp3
produces a file that is twice the length of the original - basically the same audio file repeated again.\Testing the output:
I used Quicktime and it has silent audio at the end. The description of the output file in finder says like 14 seconds. When I use VLC, it plays for the correct 6 seconds and stops, even though its duration in the file browser in VLC says 14. My MPlayer doesn't work properly. I also did the preview audio in Finder, and it plays the 6 seconds properly and then stops. But the round seeker bar of the MP3 didn't reach the end. And it also says 14 seconds instead of 6.
My goal is to stream this 6 second file through a REST API to the front end. I want the user to be able to download this file properly. Ideally it won't have inconsistent metadata (14 seconds instead of 6).
-
ffmpeg- is there any limitation on number of drawtext filter used in a single command ?
31 mars 2017, par hacki have to write different text on a number of images. The final filter command is quite large (> 500 draw text filters in a single command). I am writing this to a text file and using filter_complex_script to read it. If the number of frames and filter is small, it is working fine, but for a configuration with large number of images and draw text filters, it fails. Error is:
Cannot find a valid font for the family Sans Error initializing filter 'drawtext' with args 'enable=between(n,180,180):fontsize=28:fontfile=C\:/Windows/Fonts/Arial.ttf:fontcolor=0x000000:text=109.0:x=581:y=527-th' Error initializing complex filters. No such file or directory
-
How to add a new audio (not mixing) into a video using ffmpeg ?
31 mars 2017, par VetalllI used a command like:
ffmpeg -i video.avi -i audio.mp3 -vcodec codec -acodec codec output_video.avi -newaudio
in latest version for adding new audio track to video (not mix).
But I updated the ffmpeg to the newest version (ffmpeg version git-2012-06-16-809d71d) and now in this version the parameter
-newaudio
doesn't work.Tell me please how I can add new audio to my video (not mix) using
ffmpeg
. -
How can I play libvorbis(ogg) streams using ffplay received with udp ?
31 mars 2017, par crismanffmpeg
ffmpeg -f dshow -i audio="virtual-audio-capturer" -codec:a libvorbis -b:a 128k -ac 2 -ar 48000 -f mpegts udp://127.0.0.1:1111
ffplay
ffplay -codec:a libvorbis -b:a 128k -ar 48000 -ac 2 udp://127.0.0.1:1111
not playing audio.
Other codecs play back working, example below.
aac working
ffmpeg -f dshow -i audio="virtual-audio-capturer" -codec:a aac -b:a 128k -ac 2 -ar 48000 -f mpegts udp://127.0.0.1:1111 ffplay -codec:a aac -b:a 128k -ar 48000 -ac 2 udp://127.0.0.1:1111
opus codec working
ffmpeg -f dshow -i audio="virtual-audio-capturer" -codec:a libopus -b:a 128k -ac 2 -ar 48000 -f mpegts udp://127.0.0.1:1111 ffplay -codec:a libopus -b:a 128k -ar 48000 -ac 2 udp://127.0.0.1:1111
mp3 working
ffmpeg -f dshow -i audio="virtual-audio-capturer" -codec:a mp3 -b:a 128k -ac 2 -ar 48000 -f mpegts udp://127.0.0.1:1111 ffplay -codec:a mp3 -b:a 128k -ar 48000 -ac 2 udp://127.0.0.1:1111
why libvorbis not working?
transport success, but can not play, i think.
// not woring ffplay displayed log ffplay.exe -loglevel debug -codec:a vorbis -b:a 128k -ar 48000 -ac 2 -sync audio -i udp://127.0.0.1:1111 ffplay version N-83781-g3016e91 Copyright (c) 2003-2017 the FFmpeg developers built with gcc 6.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib libavutil 55. 48.100 / 55. 48.100 libavcodec 57. 82.102 / 57. 82.102 libavformat 57. 66.103 / 57. 66.103 libavdevice 57. 3.100 / 57. 3.100 libavfilter 6. 74.100 / 6. 74.100 libswscale 4. 3.101 / 4. 3.101 libswresample 2. 4.100 / 2. 4.100 libpostproc 54. 2.100 / 54. 2.100 [udp @ 0000000000b68700] No default whitelist set sq= 0B f=0/0 [udp @ 0000000000b68700] end receive buffer size reported is 65536 [mpegts @ 0000000000b68ac0] Format mpegts probed with size=2048 and score=50 [mpegts @ 0000000000b68ac0] stream=0 stream_type=6 pid=100 prog_reg_desc= [mpegts @ 0000000000b68ac0] Before avformat_find_stream_info() pos: 0 bytes read:8208 seeks:0 nb_streams:1 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2500 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2499 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2498 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2497 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2496 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2495 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2494= 0B f=0/0 [mpegts @ 0000000000b68ac0] Probe with size=10038, packets=7 detected mp3 with score=1 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2493= 0B f=0/0 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2492= 0B f=0/0 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2491= 0B f=0/0 [mpegts @ 0000000000b68ac0] Probe with size=18321, packets=10 detected mp3 with score=1 [mpegts @ 0000000000b68ac0] probing stream 0 pp:2490= 0B f=0/0