Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Play video with FFmpeg in Mac OS
8 mai 2018, par Maks OvcharukNeed to play video with FFmpeg programmatically in Xcode. We have command line utility, but don't have controls and components to play (like AVPlayer in AVFoundation).
Here code in swift 4:
let process = Process() process.launchPath = Bundle.main.path(forResource: "ffmpeg", ofType: "") process.arguments = ["-i", Bundle.main.path(forResource: "mov", ofType: "mov")!, "-f", "opengl"] let pipe = Pipe() process.standardOutput = pipe process.launch() process.waitUntilExit() let data = pipe.fileHandleForReading.readDataToEndOfFile() let output = NSString(data: data, encoding: String.Encoding.utf8.rawValue)
-
Error during decoding (-1094995529) Invalid data found when processing input
8 mai 2018, par Harshil MakwanaI wants Hardware Acceleration using dxva2. In my code Software decoding works fine but with hardware acceleration avcodec_send_packet return negative value(-1094995529). Help me to fix this ?
Initialization of dxva2 hardware :
enum AVHWDeviceType type = av_hwdevice_find_type_by_name("dxva2"); if (type == AV_HWDEVICE_TYPE_NONE) { fprintf(fp, "Hardware Device type is not supported.\n"); return -1; } for (int i = 0;; i++) { const AVCodecHWConfig *config = avcodec_get_hw_config(sChannelInfo[chNum].codec, i); if (!config) { fprintf(fp, "Failed to get Hardware Configuartion\n"); return -1; } if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && config->device_type == type) { hw_pix_fmt = config->pix_fmt; fprintf(fp, "config->pix_fmt %d\n", (int)hw_pix_fmt); break; } } sChannelInfo[chNum].pCodecContext->pix_fmt = AV_PIX_FMT_DXVA2_VLD; sChannelInfo[chNum].pCodecContext->get_format = get_hw_format; av_opt_set_int(sChannelInfo[chNum].pCodecContext, "refcounted_frames", 1, 0); if (hw_decoder_init(sChannelInfo[chNum].pCodecContext, type) < 0) { fprintf(fp, "hardware decoder initilisation Failed\n"); return -1; }
Decode:
int ret = avcodec_send_packet(sChannelInfo[chNum].pCodecContext, &pkt); if (ret < 0) { char buffer[64]; av_make_error_string(buffer, 64, ret); fprintf(fp, "Error during decoding %d %s\n",ret,buffer); return ret; }
Why avcodec_send_packet API return -1094995529 value? Is there anything missing in dxva2 initialization?
-
Error while building PJSIP with FFMPEG storage size of 'dstFormat' isn't known
8 mai 2018, par Dmitry ZhgunBuilding PJSIP for armeabi with FFMPEG gives me following output:
../src/pjmedia/converter_libswscale.c: In function 'factory_create_converter': ../src/pjmedia/converter_libswscale.c:70:24: error: storage size of 'srcFormat' isn't known enum AVPixelFormat srcFormat, dstFormat; ^
I've read many articles about problems with PixelFormat -> AVPixelFormat in newer versions of FFMPEG(Such as one i've built for PJSIP) - I got all of my pj sources updated according with AVPixelFormat.
Building environment:
Ubuntu 16.04 LTS 64bit running in VirtualBox
PJSIP 2.6
FFMPEG 3.0.9
Compiling PJSIP with flags:
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_FFMPEG 1
NDK-flag:
--with-ffmpeg="${BASE_DIR}/ffmpeg-output"
ffmpeg-output folder contains these files:
- libavcodec.so
- libavcodec.so.57
- libavcodec.so.57.24.102
- libavdevice.so
- libavdevice.so.57
- libavdevice.so.57.0.101
- libavfilter.so
- libavfilter.so.6
- libavfilter.so.6.31.100
- libavformat.so
- libavformat.so.57
- libavformat.so.57.25.100
- libavutil.so
- libavutil.so.55
- libavutil.so.55.17.103
- libpostproc.so
- libpostproc.so.54
- libpostproc.so.54.0.100
- libswresample.so
- libswresample.so.2
- libswresample.so.2.0.101
- libswscale.so
- libswscale.so.4
- libswscale.so.4.0.100
Trying to build different versions of FFMPEG didn't work at all(Got the same error at the end)
Any help will be appreciated.
UPD: Is there any strange stuff aboud AVPixelFormat in this part of compiler output related to ffmpeg:
checking ffmpeg packages... libavdevice libavformat libavcodec libswscale libavutil checking for enum AVPixelFormat... no checking for v4l2_open in -lv4l2... no Checking if OpenH264 is disabled... yes Skipping Intel IPP settings (not wanted)
I mean the line says "checking for enum AVPixelFormat... no" - is there any flag I need to write to say to PJSIP "you have to work with AVPixelFormat"?
-
How to crossfade 3 videos using ffmpeg ?
8 mai 2018, par Jinal SomaiyaI am currently using below command that is working fine for 2 videos but how to crossfade for 3 videos:
ffmpeg -report -i "video2.mp4" -i "video3.mp4" -an \ -filter_complex \ "[0:v]trim=start=0:end=9,setpts=PTS-STARTPTS[firstclip]; \ [1:v]trim=start=1,setpts=PTS-STARTPTS[secondclip]; \ [0:v]trim=start=9:end=10,setpts=PTS-STARTPTS[fadeoutsrc]; \ [1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc]; \ [fadeinsrc]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1[fadein]; \ [fadeoutsrc]format=pix_fmts=yuva420p,fade=t=out:st=0:d=1:alpha=1[fadeout]; \ [fadein]fifo[fadeinfifo]; \ [fadeout]fifo[fadeoutfifo]; \ [fadeoutfifo][fadeinfifo]overlay[crossfade]; \ [firstclip][crossfade][secondclip]concat=n=3" \ outputname.mp4
Thanks!
-
ffmpeg watermark
8 mai 2018, par tomiI am using a static compiled lib of FFMPEG gotten from BAMBUSER for android. The problem I am facing now is that FFMPEG version gotten from BAMBUSER does not support watermarking.
ffmpeg -sameq -i mirror_watermark.mp4 -vf "movie=mirror_watermark.png [logo]; [in][logo] overlay=main_w-overlay_w:main_h-overlay_h [out]" output.mp4 No such filter: 'movie' ./configure --list-filters | grep movie returns nothing
So I guess I have to use a newer version of FFMPEG but I do not know how to get started since with the BAMBUSER everything was already set I just added certain encoders and decoders to their script.