Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMpeg fails to compile
23 mai, par Nicolas AppriouI'm trying to compile a project that needs a specific version of ffmpeg to work.
I isolated ffmpeg build and tried to compile it on its own as done in the parent project. It seems to be version 6.1.1, the build system downloads ffmpeg from this url https://github.com/FFmpeg/FFmpeg/archive/e38092ef9395d7049f871ef4d5411eb410e283e0.zip before building it. I'm using an up-to-date debian testing distribution.
When trying to build it on my own, I got this error message:
$ ./configure --enable-shared --disable-static --disable-programs --disable-doc $ make CC libavcodec/vulkan_av1.o In file included from libavcodec/vulkan_av1.c:21: libavcodec/vulkan_decode.h:31:5: error: unknown type name ‘VkVideoDecodeAV1ProfileInfoMESA’ 31 | VkVideoDecodeAV1ProfileInfoMESA av1_profile; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:38:5: error: unknown type name ‘StdVideoAV1MESATile’ 38 | StdVideoAV1MESATile tiles[MAX_TILES]; | ^~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:39:5: error: unknown type name ‘StdVideoAV1MESATileList’ 39 | StdVideoAV1MESATileList tile_list; | ^~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:43:5: error: unknown type name ‘VkVideoDecodeAV1DpbSlotInfoMESA’ 43 | VkVideoDecodeAV1DpbSlotInfoMESA vkav1_ref; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:44:5: error: unknown type name ‘StdVideoAV1MESAFrameHeader’ 44 | StdVideoAV1MESAFrameHeader av1_frame_header; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:45:5: error: unknown type name ‘VkVideoDecodeAV1PictureInfoMESA’ 45 | VkVideoDecodeAV1PictureInfoMESA av1_pic_info; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:49:5: error: unknown type name ‘VkVideoDecodeAV1DpbSlotInfoMESA’ 49 | VkVideoDecodeAV1DpbSlotInfoMESA vkav1_refs[AV1_NUM_REF_FRAMES]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:58:29: error: unknown type name ‘VkVideoDecodeAV1DpbSlotInfoMESA’; did you mean ‘VkVideoDecodeAV1DpbSlotInfoKHR’? 58 | VkVideoDecodeAV1DpbSlotInfoMESA *vkav1_ref, /* Goes in ^ */ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeAV1DpbSlotInfoKHR libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’: libavcodec/vulkan_av1.c:113:5: error: unknown type name ‘StdVideoAV1MESASequenceHeader’; did you mean ‘StdVideoAV1SequenceHeader’? 113 | StdVideoAV1MESASequenceHeader av1_sequence_header; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | StdVideoAV1SequenceHeader libavcodec/vulkan_av1.c:114:5: error: unknown type name ‘VkVideoDecodeAV1SessionParametersAddInfoMESA’; did you mean ‘VkVideoDecodeH265SessionParametersAddInfoKHR’? 114 | VkVideoDecodeAV1SessionParametersAddInfoMESA av1_params_info; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeH265SessionParametersAddInfoKHR libavcodec/vulkan_av1.c:115:5: error: unknown type name ‘VkVideoDecodeAV1SessionParametersCreateInfoMESA’; did you mean ‘VkVideoDecodeAV1SessionParametersCreateInfoKHR’? 115 | VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeAV1SessionParametersCreateInfoKHR libavcodec/vulkan_av1.c:120:28: error: ‘StdVideoAV1MESASequenceHeader’ undeclared (first use in this function); did you mean ‘StdVideoAV1SequenceHeader’? 120 | av1_sequence_header = (StdVideoAV1MESASequenceHeader) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | StdVideoAV1SequenceHeader libavcodec/vulkan_av1.c:120:28: note: each undeclared identifier is reported only once for each function it appears in libavcodec/vulkan_av1.c:120:58: error: expected ‘;’ before ‘{’ token 120 | av1_sequence_header = (StdVideoAV1MESASequenceHeader) { | ^~ | ; libavcodec/vulkan_av1.c:171:24: error: ‘VkVideoDecodeAV1SessionParametersAddInfoMESA’ undeclared (first use in this function); did you mean ‘VkVideoDecodeH265SessionParametersAddInfoKHR’? 171 | av1_params_info = (VkVideoDecodeAV1SessionParametersAddInfoMESA) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeH265SessionParametersAddInfoKHR libavcodec/vulkan_av1.c:171:69: error: expected ‘;’ before ‘{’ token 171 | av1_params_info = (VkVideoDecodeAV1SessionParametersAddInfoMESA) { | ^~ | ; libavcodec/vulkan_av1.c:175:19: error: ‘VkVideoDecodeAV1SessionParametersCreateInfoMESA’ undeclared (first use in this function); did you mean ‘VkVideoDecodeAV1SessionParametersCreateInfoKHR’? 175 | av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoMESA) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeAV1SessionParametersCreateInfoKHR libavcodec/vulkan_av1.c:175:67: error: expected ‘;’ before ‘{’ token 175 | av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoMESA) { | ^~ | ; libavcodec/vulkan_av1.c:114:50: warning: variable ‘av1_params_info’ set but not used [-Wunused-but-set-variable] 114 | VkVideoDecodeAV1SessionParametersAddInfoMESA av1_params_info; | ^~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:113:35: warning: variable ‘av1_sequence_header’ set but not used [-Wunused-but-set-variable] 113 | StdVideoAV1MESASequenceHeader av1_sequence_header; | ^~~~~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:111:33: warning: unused variable ‘seq’ [-Wunused-variable] 111 | const AV1RawSequenceHeader *seq = s->raw_seq; | ^~~ libavcodec/vulkan_av1.c: In function ‘vk_av1_start_frame’: libavcodec/vulkan_av1.c:237:15: error: implicit declaration of function ‘vk_av1_fill_pict’ [-Werror=implicit-function-declaration] 237 | err = vk_av1_fill_pict(avctx, &ap->ref_src[i], &vp->ref_slots[i], | ^~~~~~~~~~~~~~~~ libavcodec/vulkan_av1.c:252:18: error: request for member ‘nb_tiles’ in something not a structure or union 252 | ap->tile_list.nb_tiles = 0; | ^ libavcodec/vulkan_av1.c:253:18: error: request for member ‘tile_list’ in something not a structure or union 253 | ap->tile_list.tile_list = ap->tiles; | ^ libavcodec/vulkan_av1.c:255:25: error: ‘VkVideoDecodeAV1PictureInfoMESA’ undeclared (first use in this function); did you mean ‘VkVideoDecodeAV1PictureInfoKHR’? 255 | ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoMESA) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VkVideoDecodeAV1PictureInfoKHR libavcodec/vulkan_av1.c:255:57: error: expected ‘;’ before ‘{’ token 255 | ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoMESA) { | ^~ | ; libavcodec/vulkan_av1.c:278:29: error: ‘StdVideoAV1MESAFrameHeader’ undeclared (first use in this function); did you mean ‘StdVideoAV1SequenceHeader’? 278 | ap->av1_frame_header = (StdVideoAV1MESAFrameHeader) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | StdVideoAV1SequenceHeader libavcodec/vulkan_av1.c:278:56: error: expected ‘;’ before ‘{’ token 278 | ap->av1_frame_header = (StdVideoAV1MESAFrameHeader) { | ^~ | ; libavcodec/vulkan_av1.c:402:29: error: request for member ‘tiling’ in something not a structure or union 402 | ap->av1_frame_header.tiling.width_in_sbs_minus_1[i] = frame_header->width_in_sbs_minus_1[i]; | ^ libavcodec/vulkan_av1.c:403:29: error: request for member ‘tiling’ in something not a structure or union 403 | ap->av1_frame_header.tiling.height_in_sbs_minus_1[i] = frame_header->height_in_sbs_minus_1[i]; | ^ libavcodec/vulkan_av1.c:404:29: error: request for member ‘tiling’ in something not a structure or union 404 | ap->av1_frame_header.tiling.tile_start_col_sb[i] = frame_header->tile_start_col_sb[i]; | ^ libavcodec/vulkan_av1.c:405:29: error: request for member ‘tiling’ in something not a structure or union 405 | ap->av1_frame_header.tiling.tile_start_row_sb[i] = frame_header->tile_start_row_sb[i]; | ^ libavcodec/vulkan_av1.c:409:29: error: request for member ‘segmentation’ in something not a structure or union 409 | ap->av1_frame_header.segmentation.feature_enabled_bits[i] = 0; | ^ libavcodec/vulkan_av1.c:411:33: error: request for member ‘segmentation’ in something not a structure or union 411 | ap->av1_frame_header.segmentation.feature_enabled_bits[i] |= (frame_header->feature_enabled[i][j] << j); | ^ libavcodec/vulkan_av1.c:412:33: error: request for member ‘segmentation’ in something not a structure or union 412 | ap->av1_frame_header.segmentation.feature_data[i][j] = frame_header->feature_value[i][j]; | ^ libavcodec/vulkan_av1.c:415:29: error: request for member ‘loop_filter’ in something not a structure or union 415 | ap->av1_frame_header.loop_filter.ref_deltas[i] = frame_header->loop_filter_ref_deltas[i]; | ^ libavcodec/vulkan_av1.c:417:29: error: request for member ‘cdef’ in something not a structure or union 417 | ap->av1_frame_header.cdef.y_pri_strength[i] = frame_header->cdef_y_pri_strength[i]; | ^ libavcodec/vulkan_av1.c:418:29: error: request for member ‘cdef’ in something not a structure or union 418 | ap->av1_frame_header.cdef.y_sec_strength[i] = frame_header->cdef_y_sec_strength[i]; | ^ libavcodec/vulkan_av1.c:419:29: error: request for member ‘cdef’ in something not a structure or union 419 | ap->av1_frame_header.cdef.uv_pri_strength[i] = frame_header->cdef_uv_pri_strength[i]; | ^ libavcodec/vulkan_av1.c:420:29: error: request for member ‘cdef’ in something not a structure or union 420 | ap->av1_frame_header.cdef.uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i]; | ^ libavcodec/vulkan_av1.c:422:29: error: request for member ‘ref_order_hint’ in something not a structure or union 422 | ap->av1_frame_header.ref_order_hint[i] = frame_header->ref_order_hint[i]; | ^ libavcodec/vulkan_av1.c:423:29: error: request for member ‘global_motion’ in something not a structure or union 423 | ap->av1_frame_header.global_motion[i] = (StdVideoAV1MESAGlobalMotion) { | ^ libavcodec/vulkan_av1.c:423:50: error: ‘StdVideoAV1MESAGlobalMotion’ undeclared (first use in this function); did you mean ‘StdVideoAV1GlobalMotion’? 423 | ap->av1_frame_header.global_motion[i] = (StdVideoAV1MESAGlobalMotion) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | StdVideoAV1GlobalMotion libavcodec/vulkan_av1.c:423:78: error: expected ‘;’ before ‘{’ token 423 | ap->av1_frame_header.global_motion[i] = (StdVideoAV1MESAGlobalMotion) { | ^~ | ; libavcodec/vulkan_av1.c:437:29: error: request for member ‘ref_frame_idx’ in something not a structure or union 437 | ap->av1_frame_header.ref_frame_idx[i] = frame_header->ref_frame_idx[i]; | ^ libavcodec/vulkan_av1.c:438:29: error: request for member ‘delta_frame_id_minus1’ in something not a structure or union 438 | ap->av1_frame_header.delta_frame_id_minus1[i] = frame_header->delta_frame_id_minus1[i]; | ^ libavcodec/vulkan_av1.c:441:21: error: request for member ‘skip_mode_frame_idx’ in something not a structure or union 441 | ap->av1_pic_info.skip_mode_frame_idx[0] = s->cur_frame.skip_mode_frame_idx[0]; | ^ libavcodec/vulkan_av1.c:442:21: error: request for member ‘skip_mode_frame_idx’ in something not a structure or union 442 | ap->av1_pic_info.skip_mode_frame_idx[1] = s->cur_frame.skip_mode_frame_idx[1]; | ^ libavcodec/vulkan_av1.c:446:33: error: request for member ‘film_grain’ in something not a structure or union 446 | ap->av1_frame_header.film_grain.point_y_value[i] = film_grain->point_y_value[i]; | ^ libavcodec/vulkan_av1.c:447:33: error: request for member ‘film_grain’ in something not a structure or union 447 | ap->av1_frame_header.film_grain.point_y_scaling[i] = film_grain->point_y_scaling[i]; | ^ libavcodec/vulkan_av1.c:451:33: error: request for member ‘film_grain’ in something not a structure or union 451 | ap->av1_frame_header.film_grain.point_cb_value[i] = film_grain->point_cb_value[i]; | ^ libavcodec/vulkan_av1.c:452:33: error: request for member ‘film_grain’ in something not a structure or union 452 | ap->av1_frame_header.film_grain.point_cb_scaling[i] = film_grain->point_cb_scaling[i]; | ^ libavcodec/vulkan_av1.c:453:33: error: request for member ‘film_grain’ in something not a structure or union 453 | ap->av1_frame_header.film_grain.point_cr_value[i] = film_grain->point_cr_value[i]; | ^ libavcodec/vulkan_av1.c:454:33: error: request for member ‘film_grain’ in something not a structure or union 454 | ap->av1_frame_header.film_grain.point_cr_scaling[i] = film_grain->point_cr_scaling[i]; | ^ libavcodec/vulkan_av1.c:458:33: error: request for member ‘film_grain’ in something not a structure or union 458 | ap->av1_frame_header.film_grain.ar_coeffs_y_plus_128[i] = film_grain->ar_coeffs_y_plus_128[i]; | ^ libavcodec/vulkan_av1.c:459:33: error: request for member ‘film_grain’ in something not a structure or union 459 | ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[i] = film_grain->ar_coeffs_cb_plus_128[i]; | ^ libavcodec/vulkan_av1.c:460:33: error: request for member ‘film_grain’ in something not a structure or union 460 | ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[i] = film_grain->ar_coeffs_cr_plus_128[i]; | ^ libavcodec/vulkan_av1.c:463:29: error: request for member ‘film_grain’ in something not a structure or union 463 | ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[24] = film_grain->ar_coeffs_cb_plus_128[24]; | ^ libavcodec/vulkan_av1.c:464:29: error: request for member ‘film_grain’ in something not a structure or union 464 | ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[24] = film_grain->ar_coeffs_cr_plus_128[24]; | ^ libavcodec/vulkan_av1.c: In function ‘vk_av1_decode_slice’: libavcodec/vulkan_av1.c:483:32: error: request for member ‘nb_tiles’ in something not a structure or union 483 | ap->tiles[ap->tile_list.nb_tiles] = (StdVideoAV1MESATile) { | ^ libavcodec/vulkan_av1.c:483:46: error: ‘StdVideoAV1MESATile’ undeclared (first use in this function); did you mean ‘StdVideoAV1Profile’? 483 | ap->tiles[ap->tile_list.nb_tiles] = (StdVideoAV1MESATile) { | ^~~~~~~~~~~~~~~~~~~ | StdVideoAV1Profile libavcodec/vulkan_av1.c:483:66: error: expected ‘;’ before ‘{’ token 483 | ap->tiles[ap->tile_list.nb_tiles] = (StdVideoAV1MESATile) { | ^~ | ; libavcodec/vulkan_av1.c:495:52: error: request for member ‘nb_tiles’ in something not a structure or union 495 | &ap->tile_list.nb_tiles, | ^ libavcodec/vulkan_av1.c:500:32: error: request for member ‘nb_tiles’ in something not a structure or union 500 | ap->tiles[ap->tile_list.nb_tiles - 1].offset = ap->tile_offsets[ap->tile_list.nb_tiles - 1]; | ^ libavcodec/vulkan_av1.c:500:86: error: request for member ‘nb_tiles’ in something not a structure or union 500 | ap->tiles[ap->tile_list.nb_tiles - 1].offset = ap->tile_offsets[ap->tile_list.nb_tiles - 1]; | ^ libavcodec/vulkan_av1.c: In function ‘vk_av1_end_frame’: libavcodec/vulkan_av1.c:516:23: error: request for member ‘nb_tiles’ in something not a structure or union 516 | if (!ap->tile_list.nb_tiles) | ^ libavcodec/vulkan_av1.c:534:42: error: request for member ‘nb_tiles’ in something not a structure or union 534 | vp->slices_size, ap->tile_list.nb_tiles); | ^ cc1: some warnings being treated as errors make: *** [ffbuild/common.mak:81: libavcodec/vulkan_av1.o] Error 1
The command launch above are the one taken from the parent app build system. I'm not familiar with ffmpeg or graphics system in general.
I don't understand why the first message says that
VkVideoDecodeAV1ProfileInfoMESA
could not be found. I thought I might be missing some package dependencies but it appears that aVkVideoDecodeAV1ProfileInfoMESA
typedef can be found in ffmpeg sources (libavcodec/vulkan_video_codec_av1std.h:373
in this version). So I assume something may be wrong with my compile configuration ?I'm a little bit lost on this issue and don't know what to look for to solve it.
-
Can't preserve metadata in ffmpeg video conversion
23 mai, par sakoviasI would like to preserve the creation time metadata when I convert videos using ffmpeg/avconv. Here is the file I'm trying to convert:
$ ffmpeg -i in.avi ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers built on Apr 2 2013 17:00:59 with gcc 4.6.3 Input #0, avi, from 'in.avi': Metadata: creation_time : 2013-08-12 06:59:14 encoder : CanonMVI06 Duration: 00:00:12.26, start: 0.000000, bitrate: 14549 kb/s Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc Stream #0.1: Audio: pcm_u8, 11024 Hz, 1 channels, u8, 88 kb/s
In the first approach I run
$ ffmpeg -i in.avi -vcodec libx264 -acodec libmp3lame -r 30 -map_metadata 0 out.avi
and get an output file which doesn't have the 'creation_date' metadata that I'd like to keep:
$ ffmpeg -i out.avi ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers built on Apr 2 2013 17:00:59 with gcc 4.6.3 [avi @ 0x83ba260] max_analyze_duration reached Input #0, avi, from 'out.avi': Metadata: encoder : Lavf53.21.1 Duration: 00:00:12.38, start: 0.000000, bitrate: 704 kb/s Stream #0.0: Video: h264 (Main), yuv420p, 640x480, 30 fps, 30 tbr, 30 tbn, 60 tbc Stream #0.1: Audio: mp3, 11025 Hz, mono, s16, 200 kb/s
I also tried another approach
$ ffmpeg -i in.avi -f ffmetadata metadata.txt $ ffmpeg -i in.avi -f ffmetadata -i metadata.txt -vcodec libx264 -acodec libmp3lame -r 30 out.avi
with the same success even though metadata.txt has the right info:
;FFMETADATA1 creation_time=2013-08-12 06:59:14 encoder=CanonMVI06
What am I doing wrong?
-
How to start CMD and execute command in current folder with a batch file [closed]
23 mai, par pzych0p4thI have this command that I run via cmd in a folder and it executes without problems:
for %i in (*) do ffmpeg -y -i "%i" -vcodec copy -acodec copy -map 0:v -map 0:a "%i.mp4"
Now I want to create a batch file that I can just open and it will execute this command in the current folder. However for the life of me I cannot get anything to work. Ive tried googling the answer and tried lots of answers from here also, but it seems my knowledge is lacking a bit. If anyone can give any tips that would be appreciated, thanks. I apologize beforehand if something is blatantly obvious, lmao.
-
SOLVED : How to start CMD and execute command in current folder with a batch file
22 mai, par pzych0p4thI have this command that I run via cmd in a folder and it executes without problems:
for %i in (*) do ffmpeg -y -i "%i" -vcodec copy -acodec copy -map 0:v -map 0:a "%i.mp4"
Now I want to create a batch file that I can just open and it will execute this command in the current folder. However for the life of me I cannot get anything to work. Ive tried googling the answer and tried lots of answers from here also, but it seems my knowledge is lacking a bit. If anyone can give any tips that would be appreciated, thanks. I apologize beforehand if something is blatantly obvious, lmao.
-
How to pipe in and pipe out of ffmpeg in python ? [closed]
22 mai, par sa_penguinI want to use ffmpeg as a middleman to perform a functionality. The camera frames will be read through opencv and passed to ffmpeg for processing. FFMPEG need to pass the processed frames to opencv for displaying. Below is what I tried. The code hangs and is not displaying anything. Any help will be appreciated.
import cv2 import math import subprocess as sp import ffmpeg import numpy as np def main(): cap = cv2.VideoCapture(0) if not cap.isOpened(): print("Camera can't open\nexit") return -1 width = 640 height = 480 fps = 30 out = process = ( ffmpeg .input('pipe:', vsync=0, hwaccel='cuda', hwaccel_output_format='cuda', format='rawvideo', pix_fmt='bgr24', s=f'{width}x{height}', r=f'{fps}') .filter('setsar', sar=1) # Keep the aspect ratio .output('pipe:', format='rawvideo', pix_fmt='bgr24') .run_async(pipe_stdin=True, pipe_stdout=True) ) while True: success, frame = cap.read() img = cv2.cvtColor(frame, cv2.COLOR_BayerBG2BGR) process.stdin.write(img.tobytes()) arr = np.frombuffer(process.stdout.read(width*height*3), dtype=np.uint8) cv2.imshow("webcam",arr)) cv2.waitKey(0) if __name__ == "__main__": main()