
Recherche avancée
Médias (1)
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
Autres articles (88)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (9500)
-
cuda invalid resource handle when using h264_cuvid decoder in my C program [closed]
29 juillet 2021, par ChrisFisherI try to use GPU acceleration in my ffmpeg decode program, and I check the codecs of ffmpeg by command :
ffmpeg -codecs | grep nv
, and it shows that I can use h264_cuvid decoder(In fact, I have already used ffmpeg command line to encode and decode a test video with hardware acceleration and it turned out everything was all fine), but when I use the decoder in my program

AVCodec *pCodec = avcodec_find_decoder_by_name("h264_cuvid");


here is part of my program


void FFMPEGCodec::initDecoder()
{
 AVCodec *pCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
 if (!pCodec) {
 LOG("Codec decoder not found\n");
 exit(1);
 }

 pCodecCtx = avcodec_alloc_context3(pCodec);
 if (!pCodecCtx) {
 LOG("Could not allocate video codec context\n");
 exit(1);
 }

 pCodecCtx->width = gConfig->totalWidth;
 pCodecCtx->height = gConfig->totalHeight;
 pCodecCtx->has_b_frames = 0;

 if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) {
 LOG("Could not open codec\n");
 exit(1);
 }

 if(_x264rgb){
 //used to convert GBRP frame to RGB image.
 convertCtx = sws_getContext(gConfig->totalWidth, gConfig->totalHeight, AV_PIX_FMT_GBRP, 
 gConfig->totalWidth, gConfig->totalHeight, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL); 
 } else {
 //used to convert YUV frame to RGB image.
 convertCtx = sws_getContext(gConfig->totalWidth, gConfig->totalHeight, AV_PIX_FMT_YUV420P, 
 gConfig->totalWidth, gConfig->totalHeight, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL); 
 }

 if(convertCtx == NULL){
 LOG("Failed to get SwsContext\n");
 exit(1);
 }

 //when using x264rgb, it's actually GBRP frame, 
 //just don't want to define another variable
 yuvFrame = av_frame_alloc();
 if (!yuvFrame) {
 LOG("Failed to allocate yuv frame\n");
 exit(1);
 }

 rgbFrame = av_frame_alloc();
 if (!rgbFrame) {
 LOG("Failed to allocate rgb frame\n");
 exit(1);
 }

 rgbFrame->format = AV_PIX_FMT_RGB24;
 rgbFrame->width = pCodecCtx->width;
 rgbFrame->height = pCodecCtx->height;
 
 int ret = av_image_alloc(rgbFrame->data, rgbFrame->linesize, rgbFrame->width, rgbFrame->height,
 AV_PIX_FMT_RGB24, 32);
 if (ret < 0) {
 LOG("Failed to allocate raw picture buffer\n");
 exit(1);
 }
} 



and


int FFMPEGCodec::decode(byte* pktData, int pktSize, byte* imgData)
{
 int ret = 0, got_packet = 0;
 AVPacket pkt;
 av_init_packet(&pkt);
 pkt.data = pktData;
 pkt.size = pktSize;

 // decode video frame
 ret = avcodec_decode_video2(pCodecCtx, yuvFrame, &got_packet, &pkt);
 if (ret < 0) {
 LOG("Error decoding frame\n");
 return -1;
 }

 sws_scale(convertCtx, yuvFrame->data, yuvFrame->linesize, 0, pCodecCtx->height, rgbFrame->data, rgbFrame->linesize);
 
 if (got_packet) {
 int width = pCodecCtx->width, height = pCodecCtx->height;
 int fsize = rgbFrame->linesize[0] * rgbFrame->height;
 int size = 54 + fsize;

 byte bmp_file_header[14] = { 'B', 'M', 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, };
 byte bmp_info_header[40] = { 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 24, 0, };
 byte bmp_pad[3] = { 0, 0, 0 };

 bmp_file_header[2] = (unsigned char)size;
 bmp_file_header[3] = (unsigned char)(size >> 8);
 bmp_file_header[4] = (unsigned char)(size >> 16);
 bmp_file_header[5] = (unsigned char)(size >> 24);

 bmp_info_header[4] = (unsigned char)(width);
 bmp_info_header[5] = (unsigned char)(width >> 8);
 bmp_info_header[6] = (unsigned char)(width >> 16);
 bmp_info_header[7] = (unsigned char)(width >> 24);
 bmp_info_header[8] = (unsigned char)(height);
 bmp_info_header[9] = (unsigned char)(height >> 8);
 bmp_info_header[10] = (unsigned char)(height >> 16);
 bmp_info_header[11] = (unsigned char)(height >> 24);

 memcpy(imgData, bmp_file_header, 14);
 memcpy(imgData + 14, bmp_info_header, 40);
 memcpy(imgData + 54, rgbFrame->data[0], fsize);
 ret = size;
 }
 av_free_packet(&pkt);

 return ret;
}




after compiling, I ran the program, and the decoder throw me a error :


ctx->cvdl->cuvidDecodePicture(ctx->cudecoder, picparams) failed -> CUDA_ERROR_INVALID_HANDLE: invalid resource handle

when calling the functionavcodec_decode_video2


I don't know why this error occurred, by the way, I use a GTX1060 6G(Sorry I'm not a native English speaker)


-
How to make (output file) take the name from (input mp3 file) in FFMPEG ?
23 novembre 2020, par АртемI am using Windows 7

Here is my batch file.

This batch file combines mp3 and png. By adding album art to the audio file.

@echo off
@setlocal EnableDelayedExpansion
color a
set a=Your_files\*.mp3
set aa=Your_files\*.png
set b="Result\%%~na.mp3"
set c=ffmpeg
set f=-map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)"
for %%a in (%a%) do !set mp3="%%a"!
for %%s in (%aa%) do !set png="%%s"!
%c% -y -i %mp3% -i %png% %f% %b%
exit



When I write this (%% na.mp3) he doesn't know where to get the title from.

So it outputs this as the filename (% na.mp3).

set a=Your_files\*.mp3
set aa=Your_files\*.png
set b="Result\%%~na.mp3"





-
How can I call to subprocess with input and output as file-like variables ?
4 mai 2022, par Tlaloc-ESHello I am triying to callo to ffmpeg from ubuntu, the idea is set the input a file-like object get from s3 apply a filter and upload again without write locally, the code that The first try was the following code


import subprocess
import boto3
from io import BytesIO

s3_client = boto3.client('s3')

f = BytesIO()
s3_client.download_fileobj('video', '15_19_12.mkv', f)

result = subprocess.run(['ffmpeg', "-codec copy", "aaa.mp4"], input=f.getbuffer())



But I this doesn't recognice args like "-codec copu"


Then I update to


proc = subprocess.Popen(['ffmpeg', "-codec", "copy"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate(input=f.getbuffer())



in this case, doesnt recognice the input


So how can I use Popen or another in order to set f.getbuffer and get the output file in another Bytes ?


Thanks