Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Use ffmpeg to stream live content to azure media services
9 juin 2016, par DadicoolI've been trying to stream content to azure media services using ffmpeg as it's one of the options described here : http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/
My command is :
ffmpeg -v verbose -i 300.mp4 -strict -2 -c:a aac -b:a 128k -ar 44100 -r 30 -g 60 -keyint_min 60 -b:v 400000 -c:v libx264 -preset medium -bufsize 400k -maxrate 400k -f flv rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7
I have made sure that the streaming endpoint has one active streaming unit, I also made sure that the channel is actually Ready and I even get it to start streaming (which makes a PublishURL available).
When I execute the ffmpeg command to start streaming, I keep getting the following error :
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers built on Dec 30 2014 11:31:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --arch=x86_64 --enable-runtime-cpudetect libavutil 54. 15.100 / 54. 15.100 libavcodec 56. 13.100 / 56. 13.100 libavformat 56. 15.102 / 56. 15.102 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 2.103 / 5. 2.103 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Routing option strict to both codec and muxer layer [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] overread end of atom 'colr' by 1 bytes [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] stream 0, timescale not set [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] max_analyze_duration 5000000 reached at 5003637 microseconds Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 creation_time : 2014-01-11 05:39:32 genre : Trailer artist : Warner Bros. title : 300: Rise of an Empire - Trailer 2 encoder : HandBrake 0.9.9 2013051800 date : 2014 Duration: 00:02:33.24, start: 0.000000, bitrate: 7377 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 (1920x1088), 7219 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default) Metadata: creation_time : 2014-01-11 05:39:32 encoder : JVT/AVC Coding Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default) Metadata: creation_time : 2014-01-11 05:39:32 Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7: Input/output error
The Azure blog post clearly states that this should be possible but I can't find a working example anywhere.
Environment :
- MacOS Maverick
- FFMPEG installed from official build
- 300.mp4 : 1080p trailer of the latest 300 movie
-
Building FFMPEG on UBUNTU facing issue while compiling common.mak file
9 juin 2016, par sumit singhI am compiling the ffmpeg library i am facing some issues while compiling this.
I follow the steps of compilation form here.But i am failed to compile. The issues are as below.
WARNING: /home/sumit/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-pkg-config not found, library detection may fail. libavcodec/bsf_list.c is unchanged libavformat/protocol_list.c is unchanged common.mak:26: *** unterminated call to function `foreach': missing `)'. Stop. common.mak:26: *** unterminated call to function `foreach': missing `)'. Stop. common.mak:26: *** unterminated call to function `foreach': missing `)'. Stop. sumit@sumit-H81M-S:~/android-ndk-r10e/sources/ffmpeg$
here is my build_android.sh file-
#!/bin/bash NDK=$HOME/android-ndk-r10e SYSROOT=$NDK/platforms/android-19/arch-arm/ TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86 function build_one { ./configure --prefix=$PREFIX --enable-shared --disable-static --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-doc --disable-symver --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- --target-os=linux --arch=arm --enable-cross-compile --sysroot=$SYSROOT --extra-cflags="-Os -fpic $ADDI_CFLAGS" --extra-ldflags="$ADDI_LDFLAGS" $ADDITIONAL_CONFIGURE_FLAG make clean make make install } CPU=arm PREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm" build_one
common.mak-
# # common bits used by all libraries # # first so "all" becomes default target all: all-yes DEFAULT_YASMD=.dbg ifeq ($(DBG),1) YASMD=$(DEFAULT_YASMD) else YASMD= endif ifndef SUBDIR ifndef V Q = @ ECHO = printf "$(1)\t%s\n" $(2) BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM MSG = $@ M = @$(call ECHO,$(TAG),$@); $(foreach VAR,$(BRIEF), \ $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) endif ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample # NASM requires -I path terminated with / IFLAGS := -I. -I$(SRC_LINK)/ CPPFLAGS := $(IFLAGS) $(CPPFLAGS) CFLAGS += $(ECFLAGS) CCFLAGS = $(CPPFLAGS) $(CFLAGS) OBJCFLAGS += $(EOBJCFLAGS) OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS) ASFLAGS := $(CPPFLAGS) $(ASFLAGS) CXXFLAGS += $(CPPFLAGS) $(CFLAGS) YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS) define COMPILE $(call $(1)DEP,$(1)) $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) endef COMPILE_C = $(call COMPILE,CC) COMPILE_CXX = $(call COMPILE,CXX) COMPILE_S = $(call COMPILE,AS) COMPILE_M = $(call COMPILE,OBJCC) COMPILE_HOSTC = $(call COMPILE,HOSTCC) %.o: %.c $(COMPILE_C) %.o: %.cpp $(COMPILE_CXX) %.o: %.m $(COMPILE_M) %.s: %.c $(CC) $(CCFLAGS) -S -o $@ $< %.o: %.S $(COMPILE_S) %_host.o: %.c $(COMPILE_HOSTC) %.o: %.rc $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header -DRC_INVOKED $(CC_DEPFLAGS)" -o $@ $< %.i: %.c $(CC) $(CCFLAGS) $(CC_E) $< %.h.c: $(Q)echo '#include "$*.h"' >$@ %.ver: %.v $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ | sed -e 's/:/:\ /' -e 's/; /;\ /g' > $@ %.c %.h: TAG = GEN # Dummy rule to stop make trying to rebuild removed or renamed headers %.h: @: # Disable suffix rules. Most of the builtin rules are suffix rules, # so this saves some time on slow systems. .SUFFIXES: # Do not delete intermediate files from chains of implicit rules $(OBJS): endif include $(SRC_PATH)/arch.mak OBJS += $(OBJS-yes) SLIBOBJS += $(SLIBOBJS-yes) FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) LDLIBS = $(FFLIBS:%=%$(BUILDSUF)) FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS) OBJS := $(sort $(OBJS:%=$(SUBDIR)%)) SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%)) TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o) TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF)) HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o) HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF)) TOOLS += $(TOOLS-yes) TOOLOBJS := $(TOOLS:%=tools/%.o) TOOLS := $(TOOLS:%=tools/%$(EXESUF)) HEADERS += $(HEADERS-yes) PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(2)LIBNAME)) DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S))) STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib))) SRC_DIR := $(SRC_PATH)/lib$(NAME) ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h)) SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-) SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o)) checkheaders: $(HOBJS) .SECONDARY: $(HOBJS:.o=.c) alltools: $(TOOLS) $(HOSTOBJS): %.o: %.c $(COMPILE_HOSTC) $(HOSTPROGS): %$(HOSTEXESUF): %.o $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTLIBS) $(OBJS): | $(sort $(dir $(OBJS))) $(HOBJS): | $(sort $(dir $(HOBJS))) $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS))) $(SLIBOBJS): | $(sort $(dir $(SLIBOBJS))) $(TESTOBJS): | $(sort $(dir $(TESTOBJS))) $(TOOLOBJS): | tools OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ver-sol2 *.ho *.gcno *.gcda *$(DEFAULT_YASMD).asm DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a define RULES clean:: $(RM) $(HOSTPROGS) $(RM) $(TOOLS) endef $(eval $(RULES)) -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_YASMD).d)
-
Cannot wrie header FFMPEG
9 juin 2016, par Van GanI'm working on a Project with FFMPEg, but somehow i cannot creae any media file. I've set the Parameters, codec etc. but when i call avformat_write_header the app just stops working. Here's my code:
AVOutputFormat *fmt; AVCodecContext *codecctx; AVFormatContext *fmtctx; fmt=av_guess_format(NULL,filename,NULL); AVCodec *codec = avcodec_find_encoder(fmt->video_codec); codecctx = avcodec_alloc_context3(codec); codecctx->codec_id = fmt->video_codec; codecctx->codec_type = AVMEDIA_TYPE_VIDEO; codecctx->gop_size = 12; codecctx->bit_rate = WIDTH*HEIGHT*4; codecctx->width = WIDTH; codecctx->height = HEIGHT; codecctx->time_base.den = 2; codecctx->time_base.num =1; //codecctx->time_base =(AVRational){1,FPS}; codecctx->max_b_frames=1; codecctx->pix_fmt= STREAM_PIX_FMT; fmtctx = avformat_alloc_context(); fmtctx->oformat = fmt; fmtctx->video_codec_id = fmt->video_codec; avcodec_open2(codecctx, codec, NULL); AVStream *VideoStream = avformat_new_stream(fmtctx,codec); avformat_write_header(fmtctx,NULL);
-
ffmpeg : Combine/merge multiple mp4 videos - not working
9 juin 2016, par dtbakerHere is the command I am using to combine multiple videos:
ffmpeg -i 75_540_38HQ2.mp4 -i 76_70_20.mp4 -i 76_173_80.mp4 -i 81_186_35.mp4 -vcodec copy -acodec copy Mux1.mp4
The resulting
Mux1.mp4
does not contain all videos. Only the first video (75_540_38HQ2.mp4
). The file size of the source and resulting video is below (as you can see, resulting video is slightly larger than first vid):$ ls -lh -rw-r--r-- 1 dbaker dbaker 42M 2011-03-24 11:59 75_540_38HQ2.mp4 -rw-r--r-- 1 dbaker dbaker 236M 2011-03-24 12:09 76_173_80.mp4 -rw-r--r-- 1 dbaker dbaker 26M 2011-03-24 12:05 76_70_20.mp4 -rw-r--r-- 1 dbaker dbaker 54M 2011-03-24 12:15 81_186_35.mp4 -rw-r--r-- 1 dbaker dbaker 44M 2011-03-24 14:48 Mux1.mp4
Here is the output of the
ffmpeg
command. To me it looks ok, showing the multiple source inputs and the single output.FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers built on Mar 21 2011 18:05:32 with gcc 4.4.5 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab libavutil 50.36. 0 / 50.36. 0 libavcore 0.16. 1 / 0.16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52.93. 0 / 52.93. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1.74. 0 / 1.74. 0 libswscale 0.12. 0 / 0.12. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '75_540_38HQ2.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.93.0 Duration: 00:00:29.99, start: 0.000000, bitrate: 11517 kb/s Stream #0.0(eng): Video: h264, yuv420p, 1280x960 [PAR 1:1 DAR 4:3], 11575 kb/s, 29.94 fps, 29.97 tbr, 30k tbn, 59.94 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 127 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '76_70_20.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.93.0 Duration: 00:00:19.98, start: 0.000000, bitrate: 10901 kb/s Stream #1.0(eng): Video: h264, yuv420p, 1280x960 [PAR 1:1 DAR 4:3], 10804 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #1.1(eng): Audio: aac, 48000 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '76_173_80.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.93.0 Duration: 00:03:09.99, start: 0.000000, bitrate: 10393 kb/s Stream #2.0(eng): Video: h264, yuv420p, 1280x960 [PAR 1:1 DAR 4:3], 10321 kb/s, 29.96 fps, 29.97 tbr, 30k tbn, 59.94 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #2.1(eng): Audio: aac, 48000 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 30000.00 (30000/1) Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '81_186_35.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.93.0 Duration: 00:00:35.00, start: 0.000000, bitrate: 12700 kb/s Stream #3.0(eng): Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 12620 kb/s, 59.91 fps, 30k tbr, 60k tbn, 119.88 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #3.1(eng): Audio: aac, 48000 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Output #0, mp4, to 'Mux1.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.93.0 Stream #0.0(eng): Video: libx264, yuv420p, 1280x960 [PAR 1:1 DAR 4:3], q=2-31, 11575 kb/s, 30k tbn, 29.97 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(eng): Audio: libfaac, 48000 Hz, stereo, 128 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Stream mapping: Stream #0.0 -> #0.0 Stream #2.1 -> #0.1 Press [q] to stop encoding frame= 883 fps=632 q=-1.0 Lsize= 44730kB time=29.40 bitrate=12465.1kbits/s video:41678kB audio:2969kB global headers:0kB muxing overhead 0.184548%
Am I doing something blindingly stupid here?
The source videos came from a video camera, and are small snippets taken with
ffmpeg -i bigfile.mp4 -ss 20 -t 10 -vcodec copy etc..
Thanks heaps!! Dave
Edit: couldn't solve it so I just use avidemux GUI tool. It seemed to append the MP4's just fine.
Must be a problem with MP4's or just the ones that come off a gopro camera.
-
Conversion of .iva to .mp4 using ffmpeg
9 juin 2016, par Rupesh ParabThe video which I am trying to convert is uploaded at http://www.filedropper.com/video_17
I am using the following command to convert the file:
ffmpeg -i archive.iva -c copy -map 0 output.mp4 -vsync 2 -y;
The file should be around 1 min in length but after conversion is of only 7 secs
What am I doing wrong?
Edit
Console Output:
rupesh@rupesh-Lenovo-IdeaPad-Y510P:~/video$ ffmpeg -i archive.iva -c copy -map 0 output.mp4 -vsync 2 -y; ffmpeg version N-80026-g936751b Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 42.100 / 57. 42.100 libavformat 57. 36.100 / 57. 36.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 45.100 / 6. 45.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [mjpeg @ 0x3a2eda0] Format mjpeg detected only with low score of 25, misdetection possible! Input #0, mjpeg, from 'archive.iva': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 25 fps, 25 tbr, 1200k tbn [mp4 @ 0x3a309c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf57.36.100 Stream #0:0: Video: mjpeg (l[0][0][0] / 0x006C), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, q=2-31, 25 fps, 25 tbr, 1200k tbn Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 190 fps=0.0 q=-1.0 Lsize= 5909kB time=00:00:07.56 bitrate=6403.2kbits/s speed= 127x video:5908kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.026134%