Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Is it possible to run the ffmpeg command as a server ?
23 janvier, par Parlor311Instead of running the "ffmpeg" command on every request in my REST API, I want to be able to run it a single time as a server, a separate process or service, and have the REST endpoint call the server over any supported protocol. The endpoint should be able to stream the input and receive the streamed output from the server. Is this possible using the ffmpeg CLI? I can't find a single resource that covers this use case. If possible to provide the right command configuration. Thank you.
-
How to allocate and assign memory to AVFrame in FFMPEG application ?
23 janvier, par wangt13I am working on a video player in an embedded Linux system (5.10.200), I am using FFMPEG-4.4.4 libraries to build the player.
Now, I want to assign pre-allocated
buffer
toAVFrame
to capture the decoded data. So I did followings.#define FRM_WIDTH 1920 #define FRM_HEIGHT 1080 AVFrame myframe; uint8_t *buffer; int init_frame_buffer(void) { int num_bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB32, FRM_WIDTH, FRM_HEIGHT, 1); buffer = (uint8_t *)av_malloc(num_bytes * sizeof(uint8_t)); av_image_fill_arrays(myframe.data, myframe.linesize, buffer, AV_PIX_FMT_RGB32, FRM_WIDTH, FRM_HEIGHT, 1); .... } int process_decoded_frame(AVFrame *pframe) { // Can use buffer to process the decoded frame? } int process_packet(AVCodecContext *codectx, AVPacket *pkt) { int ret = avcodec_send_packet(codectx, pkt); AVFrame *pframe = &myframe; if (ret < 0) { fprintf(stderr, "Error sending packet for decoding\n"); return ret; } while (ret >= 0) { ret = avcodec_receive_frame(codectx, pframe); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { break; } else if (ret < 0) { fprintf(stderr, "Error during decoding\n"); goto out; } process_decoded_frame(pframe); //// <<<< } }
- Allocate a
buffer
; - Assign it to
myframe
; - Use
myframe
inavcodec_receive_frame
, hoping to capture decoded frame intomyframe
andbuffer
. - Process the decoded data directly with
buffer
.
So is it possible for me to do above steps to assign pre-allocated
buffer
to a frame and process decoded data directly withbuffer
? - Allocate a
-
HLS playback stopped with Player error : mediaError - bufferAppendError
23 janvier, par SumoanandI am trying to merge two videos together in the m3u8 manifest file. However, exactly at the point to HLS stream discontinuity, video playback stops with following error: Player error: mediaError - bufferAppendError
Here is the sample m3u8 snippet:
#EXT-X-PROGRAM-DATE-TIME:2025-01-23T01:23:10.200-06:00 #EXTINF:6.000 17.ts #EXT-X-PROGRAM-DATE-TIME:2025-01-23T01:23:16.200-06:00 #EXTINF:6.000 18.ts #EXT-X-DISCONTINUITY #EXT-X-KEY:METHOD=NONE #EXT-X-PROGRAM-DATE-TIME:2025-01-23T01:23:21.700-06:00 #EXTINF:6.000 10ak171685189367-007cb1c1a5398250e495vHD.20.ts #EXT-X-PROGRAM-DATE-TIME:2025-01-23T01:23:27.700-06:00 #EXTINF:6.000 10ak171685189367-007cb1c1a5398250e495vHD.21.ts
FFprobe output of 18.ts:
Duration: 00:00:06.01, start: 1692.774667, bitrate: 3440 kb/s Program 1 Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 159 kb/s
FFprobe output of 10ak171685189367-007cb1c1a5398250e495vHD.20.ts:
Duration: 00:00:06.02, start: 1.443444, bitrate: 744 kb/s Program 1 Metadata: Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 65 kb/s
I would greatly appreciate any inputs.
-
How to allocate and specify memory to AVFrame in FFMPEG application ?
23 janvier, par wangt13I am working on a video player in an embedded Linux system (5.10.200), I am using FFMPEG-4.4.4 libraries to build the player.
Now, I want to assign pre-allocated
buffer
toAVFrame
to capture the decoded data. So I did followings.#define FRM_WIDTH 1920 #define FRM_HEIGHT 1080 AVFrame myframe; uint8_t *buffer; int init_frame_buffer(void) { int num_bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB32, FRM_WIDTH, FRM_HEIGHT, 1); buffer = (uint8_t *)av_malloc(num_bytes * sizeof(uint8_t)); av_image_fill_arrays(myframe.data, myframe.linesize, buffer, AV_PIX_FMT_RGB32, FRM_WIDTH, FRM_HEIGHT, 1); .... } int process_decoded_frame(AVFrame *pframe) { // Can use buffer to process the decoded frame? } int process_packet(AVCodecContext *codectx, AVPacket *pkt) { int ret = avcodec_send_packet(codectx, pkt); AVFrame *pframe = &myframe; if (ret < 0) { fprintf(stderr, "Error sending packet for decoding\n"); return ret; } while (ret >= 0) { ret = avcodec_receive_frame(codectx, pframe); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { break; } else if (ret < 0) { fprintf(stderr, "Error during decoding\n"); goto out; } process_decoded_frame(pframe); //// <<<< } }
- Allocate a
buffer
; - Assign it to
myframe
; - Use
myframe
inavcodec_receive_frame
, hoping to capture decoded frame intomyframe
andbuffer
. - Process the decoded data directly with
buffer
.
So is it possible for me to do above steps to assign pre-allocated
buffer
to a frame and process decoded data directly withbuffer
? - Allocate a
-
How do you get ffmpeg to convert a video, parse its thumbnail and then pass it back to Elgg in the file upload function ? [closed]
22 janvier, par OrangeI know my question is very specific, but I'm using the social media base (with WAMP) Elgg to create a Flash-based video sharing site for older browsers and computers and I was wondering how does one set up ffmpeg and Elgg in tandem so Elgg gets both a thumbnail and a video converted to FLV from an MP4 file someone uploads from their computer.
I'm using Elgg 1.9 and ffmpeg-20130314.
I couldn't figure out how to inject ffmpeg into Elgg so I tried duplicating the upload form so it had two file upload buttons (second one for thumbnail image) but this broke the site and made a blank undeletable video.