
Recherche avancée
Autres articles (20)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (3252)
-
FFmpeg : chromakey without green edges
5 septembre 2020, par IgniterI have a video of a person on green background and I'm trying to turn background transparent by this :


ffmpeg -i bg.mp4 -i man.mp4 -filter_complex '[1:v]colorkey=0x00ff00:0.3:0.3[ckout];[0:v][ckout]overlay[out]' -map '[out]' result.mp4



Colorkey gives this quite noticeable green edge around the person's figure.

Any attempts to increase opacity or blend parameters result in disappearing facial features.



Is there any smart way to change pure green
0x00ff00
pixels with transparent ones ?

-
avcodec/movtextenc : Simplify writing to AVBPrint
15 octobre 2020, par Andreas Rheinhardtavcodec/movtextenc : Simplify writing to AVBPrint
The mov_text encoder uses an AVBPrint to assemble the subtitles ;
yet mov_text subtitles are not pure text ; they also have a binary
portion that was mostly handled as follows :uint32_t size = /* calculation */ ;
size = AV_RB32(&size) ;
av_bprint_append_data(bprint, (const char*)&size, 4) ;Here AV_RB32() is a no-op on big-endian systems and a LE-BE swap
on little-endian systems, making the output endian-independent.Yet this is ugly and unclean : On LE systems, the variable size from
the snippet above won't contain the correct value any more. Furthermore,
using this pattern leads to lots of small writes to the AVBPrint.This commit therefore changes this to using a temporary buffer instead :
uint8_t buf[4] ;
AV_WB32(buf, /* size calculation */) ;
av_bprint_append_data(bprint, buf, 4) ;This method also allows to use bigger buffers holding more than one
element, saving calls to av_bprint_append_data() and reducing codesize.Reviewed-by : Philip Langdale <philipl@overt.org>
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com> -
What could be serve as a nullptr in cython wrapper for C++ uint8_t multidimensional array ?
20 juillet 2020, par yose93I've stuck with solving of one problem. I have to fill C++ structure with yuv420p frame data in my cython wrapper :


#define FR_PLANE_COUNT_MAX 8

typedef struct fr_frame_s {
 int format = 0;

 int width = 0;
 int height = 0;

 uint8_t* data[FR_PLANE_COUNT_MAX];

 int stride[FR_PLANE_COUNT_MAX];

 int size[FR_PLANE_COUNT_MAX];

 long long time = 0;

} fr_frame_t;





Where
data
is just a multidimensional array with length of 8. In this array first three elements to be y, u and v byte multidimensional arrays, and the rest are justnullptr
values. The next chunk of code which I need to implement on pure python just to fill the structure with according data of the above structure itself :

bool VideoCapture::ConvertFrame(const AVFrame *src, fr_frame_t &dst)
{
 if(src != NULL)
 {
 for (size_t i = 0; i < FR_PLANE_COUNT_MAX; ++i)
 {
 if (src->data[i] != nullptr)
 {
 const int line = src->linesize[i];
 const int size = i == 0 ? line * src->height : int(line * (src->height / 2.0));
 dst.data[i] = (uint8_t*)malloc(size);
 memcpy(dst.data[i], src->data[i], size);

 //dst.data[i] = src->data[i];
 dst.size[i] = size;
 dst.stride[i] = src->linesize[i];
 }else{
 dst.data[i] = nullptr;
 dst.size[i] = 0;
 dst.stride[i] = 0;
 }
 }




Here all the values after y, u, v arrays must be just of
nullptr
as it seems. So, what I can use asnullptr
to fillnp.ndarray
after y, u, v.

And my python code :


def _get_read_frames(
 self,
 video: pathlib.PosixPath,
 ) -> Generator[Tuple[Union[teyefr.MetadataImage, float]], None, None]:
 """Video frames reader."""
 self._cap = cv2.VideoCapture(str(video))
 self._total_frames = self._cap.get(cv2.CAP_PROP_FRAME_COUNT)
 self._fps = math.ceil(self._cap.get(cv2.CAP_PROP_FPS))
 self._duration = self._total_frames / self._fps

 while(self._cap.isOpened()):
 _, frame = self._cap.read()

 if frame is None:
 break
 
 yuv420_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2YUV)

 self._process_yuv420_frame(yuv420_frame)

 self._cap.release()
 
 def _process_yuv420_frame(self, yuv420_frame: np.ndarray) -> None:
 """To fill `self._fr_frames` list.

 Splits already converted frame into 3-channels y, u, v
 and takes all required data to fill `FRFrame` and push it.
 """
 data = np.array([])
 stride = np.array([])
 size = np.array([])
 frame_data = {}.fromkeys(FRFrame.__dataclass_fields__.keys())

 channels = (y, u, v) = cv2.split(yuv420_frame)

 for i in range(FR_PLANE_COUNT_MAX):
 if i < len(channels):
 np.concatenate(data, channels[i])
 else:
 np.concatenate(data, np.array([]))
 
 frame_data['height'], frame_data['width'], _ = yuv420_frame.shape



Please advise.