Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
what codecs in tag i need ?
30 août 2017, par ВикторI used to ffmpeg command
ffmpeg -y -i #FILE_NAME# -s 640x360 -f mp4 -vcodec libx264 -vpre hq -threads 0 -b 512k -bt 512k -r 25 -g 25 -acodec libfaac -ab 96k -ar 22050 #CONEVRTED_FILE_NAME#
Now I don't understand what I need to use in my tag ?
"
This option does not work
-
FFMpeg audio conversion from lower to higher, increases audio by 2 seconds [migrated]
30 août 2017, par Dilip KumarI tested ffmpeg to convert a 90 kbps mp3 to 128 kbps.
ffmpeg -i "test.mp3" -vn -ar 44100 -ac 2 -ab 128k -f mp3 "test1.mp3"
Conversion works but the problem is with the audio that converted increases by 2 more seconds. The original audio is 01:36 and the converted audio becomes 01:38. I also tried with some other audios.
Here i am trying to convert from lower to higher. But if i convert higher like 190 kbps to 128 kbps lower, then it works properly.
Is there something wrong with the ffmpeg?
-
ffmpeg : how add watermark to all video outputs ?
30 août 2017, par Mim MontazarI have a simple code that takes my video files (in my folder) and converts them to 480x360:
for %f in (*.mp4) do ffmpeg -i "%f" -vcodec libx264 -s 352x240 -acodec copy -f mp4 "%~nf-240p.mp4" -vcodec libx264 -s 480x360 -acodec copy -f mp4 "%~nf-360p.mp4"
It works correctly, but I want to add a watermark with the following options:
-i watermark.png -filter_complex "overlay=10:10"
After adding these options:
for %f in (*.mp4) do ffmpeg -i "%f" -i watermark.png -filter_complex "overlay=10:10" -vcodec libx264 -s 352x240 -acodec copy -f mp4 "%~nf-240p.mp4" -vcodec libx264 -s 480x360 -acodec copy -f mp4 "%~nf-360p.mp4"
it just adds watermark on 240p.mp4. How do I apply this filter to all files?
Thanks.
-
Malloc Check Failed when opening video stream
30 août 2017, par donturnerI'm writing a BlackBerry 10 application which decodes an H264 video stream (from a Parrot AR Drone) using ffmpeg and libx264. These libraries have both been compiled for BlackBerry QNX.
Here's my code:
av_register_all(); avcodec_register_all(); avformat_network_init(); printf("AV setup complete\n"); const char* drone_addr = "http://192.168.1.1:5555"; AVFormatContext* pFormatCtx = NULL; AVInputFormat* pInputFormat = av_find_input_format("H264"); printf("Opening video feed from drone\n"); //THIS LINE FAILS int result = avformat_open_input(&pFormatCtx, drone_addr, pInputFormat, NULL);
The last line fails with the error:
Malloc Check Failed: :../../dlist.c:1168
How can I fix this error or debug it further?
Update: The error only occurs when I supply
pInputFormat
toavformat_open_input
. If I supply NULL I don't get an error. But for my app I must supply this parameter since it is not possible for ffmpeg to determine the video format from the feed alone. -
How to solve the error during the conversion between FFmpeg's avframe and OpenCV's mat ?
30 août 2017, par md612I made the conversion between FFmpeg's avframe and OpenCV's mat. But the following code doesn't convert the mat format to avframe format correctly. The first part converts avframe to mat format and the second part converts mat to avframe format.
Here is my source code:
AVFrame* ProcessFrame(AVFrame *frame, int stream_index) { //first part AVStream *in_stream = ifmt_ctx->streams[stream_index]; AVCodecContext *pCodecCtx = in_stream->codec; AVFrame *pFrameRGB = NULL; struct SwsContext * img_convert_ctx = NULL; if(img_convert_ctx == NULL){ img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL); } pFrameRGB = av_frame_alloc(); int size = avpicture_get_size(AV_PIX_FMT_BGR24, pCodecCtx->width, pCodecCtx->height); uint8_t *out_bufferRGB = (uint8_t *)av_malloc(size); avpicture_fill((AVPicture *)pFrameRGB, out_bufferRGB, AV_PIX_FMT_BGR24, pCodecCtx->width, pCodecCtx->height); sws_scale(img_convert_ctx, frame->data, frame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize); Mat imageFrame = Mat(pCodecCtx->height, pCodecCtx->width, CV_8UC3, out_bufferRGB); delete[] out_bufferRGB; /////////////////////////////////////////////////////////// //second part starts avpicture_fill((AVPicture *)pFrameRGB, imageFrame.data,AV_PIX_FMT_BGR24, pCodecCtx->width, pCodecCtx->height); struct SwsContext * convert_ctx = NULL; if(convert_ctx == NULL){ convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_BGR24, pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL); } AVFrame *srcFrame = av_frame_alloc(); size = avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height); uint8_t *out_buffer = (uint8_t *)av_malloc(size); avpicture_fill((AVPicture *)srcFrame, out_buffer, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height); sws_scale(convert_ctx, pFrameRGB->data, pFrameRGB->linesize, 0, pCodecCtx->height, srcFrame->data, srcFrame->linesize); delete[] out_buffer; av_free(pFrameRGB); srcFrame->width = frame->width; srcFrame->height = frame->height; srcFrame->format = frame->format; av_frame_copy_props(srcFrame, frame); return srcFrame; }