
Recherche avancée
Autres articles (71)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Qualité du média après traitement
21 juin 2013, parLe bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)
Sur d’autres sites (11135)
-
the workstation' Image decode and render perform,use same code,worse than laptop
12 janvier 2024, par karma1995i'm working on Image decoding and rendering,trying to develop a software to process and display 4K TIFF and DPX sequence.Developing on my laptop and testing on both laptop and workstation.It's wired that workstaion's performance worse than laptop,my hardware and code information is here :
The information of both machine


- 

- Laptop
platform : windows 11
CPU : Intel I9-13900H 14C 20T
GPU : RTX 4060 Laptop GPU
Mem : 64G
Disk : SSD
- Workstaton
platform : windows 10
CPU : Intel Xeon 56C 112T
GPU : RTX A6000
Mem : 512
Disk : SSD
IDE
IDE is Qt, version 5.14.0, both on laptop and workstation.






For Image decoding, ffmpeg is used


void SeqDecodeTask::run()
{
 QElapsedTimer timer;
 timer.start();
 SwsContext* swsCtx = nullptr;
 AVPixelFormat srcFmt = AV_PIX_FMT_NONE;
 AVPixelFormat dstFmt = AV_PIX_FMT_NONE;
 AVFormatContext* fmtCtx;
 const AVCodec* codec;
 AVCodecContext* codecCtx;
 AVStream* stream;
 int index = -1;
 AVPacket pkt;
 AVFrame* frame = av_frame_alloc();
 AVFrame* output = av_frame_alloc();
 fmtCtx = avformat_alloc_context();

 if(avformat_open_input(&fmtCtx, file_.toUtf8(),
 nullptr, nullptr) < 0) {
 return;
 }
 if (avformat_find_stream_info(fmtCtx, nullptr) < 0) {
 return;
 }
 for (unsigned int i = 0; i < fmtCtx->nb_streams; i++) {
 if (fmtCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
 index = static_cast<int>(i);
 continue;
 }
 }
 if (index < 0) {
 return;
 }
 stream = fmtCtx->streams[index];
 fmtCtx->streams[index]->discard = AVDISCARD_DEFAULT;
 codecCtx = avcodec_alloc_context3(nullptr);
 if (avcodec_parameters_to_context(
 codecCtx,
 fmtCtx->streams[index]->codecpar) < 0) {
 return;
 }
 codec = avcodec_find_decoder(codecCtx->codec_id);
 if (codec == nullptr) {
 return;
 }
 if (avcodec_open2(codecCtx, codec, nullptr) < 0) {
 return;
 }
 av_read_frame(fmtCtx, &pkt);
 avcodec_send_packet(codecCtx, &pkt);
 avcodec_receive_frame(codecCtx, frame);

 if (srcFmt == AV_PIX_FMT_NONE) {
 srcFmt = static_cast<avpixelformat>(frame->format);
 }
 dstFmt = AV_PIX_FMT_RGBA64LE;
 cv::Mat mat(cv::Size(frame->width, frame->height), CV_16UC4);
 if (!(frame->width < 0 || frame->height < 0)) {
 if (swsCtx == nullptr) {
 swsCtx = sws_alloc_context();
 swsCtx = sws_getContext(frame->width,
 frame->height,
 srcFmt,
 frame->width,
 frame->height,
 dstFmt,
 SWS_BICUBIC, nullptr,
 nullptr, nullptr);
 }

 swsCtx = sws_getContext(frame->width, frame->height,
 srcFmt,
 frame->width, frame->height,
 dstFmt,
 SWS_BICUBIC, nullptr, nullptr, nullptr);
 av_image_fill_arrays(output->data, output->linesize,
 static_cast(mat.data),
 dstFmt,
 frame->width, frame->height, 1);
 sws_scale(swsCtx, static_cast<const>(frame->data),
 frame->linesize, 0, frame->height, output->data, output->linesize);
 }
 av_packet_unref(&pkt);
 av_frame_free(&output);
 av_frame_free(&frame);
 sws_freeContext(swsCtx);
 avcodec_free_context(&codecCtx);
 avformat_free_context(fmtCtx);

 buffer_->edit(true, item_, index_, file_, mat);

 emit decodeTaskFinished();
 qDebug() << "decode time " << timer.elapsed();
}
</const></avpixelformat></int>


Simply get the media information, decode, format transform and store in mat.It's a QRunnable class for multithread.


For rendering, have tried both QPainter and SceneGraph
QPainter :


void PaintedItemRender::paint(QPainter *painter)
{
 QElapsedTimer timer;
 timer.start();
 painter->setRenderHint(QPainter::Antialiasing, true);
 int width = this->width();
 int height = this->height();
// if (defaultWidth_ == NULL || defaultHeight_ == NULL) {
// defaultWidth_ = width;
// defaultHeight_ = height;
// }
 painter->setBrush(Qt::black);
 painter->drawRect(0, 0, width, height);

 QImage img = image_.scaled(QSize(width, height), Qt::KeepAspectRatio);
 /* calculate display position */
 int x = (this->width() - img.width()) / 2;
 int y = (this->height() - img.height()) / 2;

 painter->drawImage(QPoint(x, y), img);
 qDebug() << "paint time: " <code>


SceneGraph


QSGNode *SceneGraphRender::updatePaintNode(QSGNode* oldNode,
 QQuickItem::UpdatePaintNodeData* updatePaintNodeData)
{
 Q_UNUSED(updatePaintNodeData)
 QSGSimpleTextureNode* tex = nullptr;
 QSGTransformNode* trans = nullptr;
 if(!oldNode) {
 tex = new QSGSimpleTextureNode;
 tex->setFlag(QSGNode::OwnsMaterial, true);
 tex->setFiltering(QSGTexture::Linear);
 tex->setTexture(window()->createTextureFromImage(image_));
 tex->setRect(0, 0, width(), height());
 trans = new QSGTransformNode();
 if (!image_.isNull()) {
 float factorW = 1;
 float factorH = 1;
 if (image_.width() > width()) {
 factorH = factorW = width() / image_.width();
 }
 else if (image_.height() > height()) {
 factorW = factorH = height() / image_.height();
 }
 else if (image_.width() < width() && image_.height() < height()) {
 if (width() - image_.width() < image_.height() - height()) {
 factorH = factorW = width() / image_.width();
 }
 else {
 factorH = factorW = height() / image_.height();
 }
 }
 QMatrix4x4 mat;
 float scaledW = tex->rect().width() * factorW;
 float scaledH = tex->rect().height() * factorH;
 if (width() > scaledW) {
 mat.translate((width() - tex->rect().width() * factorW) / 2, 0);
 }
 if (height() > scaledH) {
 mat.translate(0, (height() - tex->rect().height() * factorH) / 2);
 }
 mat.scale(factorW, factorH);
 trans->setMatrix(mat);
 trans->markDirty(QSGNode::DirtyMatrix);
 }
 else {
 scaled_ = true;
 }
 trans->appendChildNode(tex);
 }
 else {
 trans = static_cast<qsgtransformnode>(oldNode);
 tex = static_cast<qsgsimpletexturenode>(trans->childAtIndex(0));
 QSGTexture* texture = tex->texture();
 tex->setTexture(window()->createTextureFromImage(image_));
 tex->setRect(0, 0, image_.width(), image_.height());
 texture->deleteLater();
 if(!image_.isNull() && scaled_) {
 float factorW = 1;
 float factorH = 1;
 if (image_.width() > width()) {
 factorH = factorW = width() / image_.width();
 }
 else if (image_.height() > height()) {
 factorW = factorH = height() / image_.height();
 }
 else if (image_.width() < width() && image_.height() < height()) {
 if (width() - image_.width() < image_.height() - height()) {
 factorH = factorW = width() / image_.width();
 }
 else {
 factorH = factorW = height() / image_.height();
 }

 }
 QMatrix4x4 mat;
 float scaledW = tex->rect().width() * factorW;
 float scaledH = tex->rect().height() * factorH;
 if (width() > scaledW) {
 mat.translate((width() - tex->rect().width() * factorW) / 2, 0);
 }
 if (height() > scaledH) {
 mat.translate(0, (height() - tex->rect().height() * factorH) / 2);
 }
 mat.scale(factorW, factorH);
 trans->setMatrix(mat);
 trans->markDirty(QSGNode::DirtyMatrix);
 scaled_ = false;
 }
 }
 return trans;
}
</qsgsimpletexturenode></qsgtransformnode>


Time Usage
Test image sequence is 4K DPX sequence, 12 bits, RGB.Decode only use one thread ;


- 

- Laptop
decoding : around 200ms per frame
rendering : around 20ms per frame
- Workstation
decoding : over 600ms per frame
rendering : around 80ms per frame






i'm tring to figure out the reason that make performance diffrent and fix it, appreciate for any advice, thank you.


-
when using ffmpeg encode to hevc , but got 'rawvideo' [closed]
3 septembre 2023, par 112292454i tried use ffmpeg to convert some types video to h265 to save disk space
but for some video, successfully converted and the file size smaller, but cannot play。
the result video codec name is "rawvideo",not hevc.


the ffporbe of raw video is


ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
 built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
 configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, avi, from 'xxx.avi':
 Duration: 00:06:11.62, start: 0.000000, bitrate: 5196 kb/s
 Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5057 kb/s, 29 fps, 29 tbr, 29 tbn
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s



or


ffprobe -v error -show_entries stream=duration,r_frame_rate,bit_rate,width,height,codec_name:stream=codec_name,bit_rate:stream=sample_rate -of json 'xxx.avi'
{
 "programs": [

 ],
 "streams": [
 {
 "codec_name": "mpeg4",
 "width": 1280,
 "height": 720,
 "r_frame_rate": "29/1",
 "duration": "371.620058",
 "bit_rate": "5057186"
 },
 {
 "codec_name": "mp3",
 "sample_rate": "44100",
 "r_frame_rate": "0/0",
 "bit_rate": "128000"
 }
 ]
}



then, i used ffmpeg simple
(I'm guessing that this problem is just a stupid mistake of newbie,maybe like not use avi ? And the raw video is nsfw, maybe not suitable for release, XD--------but if really need it,can also supply)


ffmpeg -i xxx.avi -c:v libx265 'compressed_xxx.avi'

ffmpeg version 5.1.2-3ubuntu1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
 configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, avi, from 'xxx.avi':
 Duration: 00:06:11.62, start: 0.000000, bitrate: 5196 kb/s
 Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5057 kb/s, 29 fps, 29 tbr, 29 tbn
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
File 'compressed_xxx.avi' already exists. Overwrite? [y/N] y

Stream mapping:
 Stream #0:0 -> #0:0 (mpeg4 (native) -> hevc (libx265))
 Stream #0:1 -> #0:1 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 11.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool 0 using 40 threads on numa nodes 0,1
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 5 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=4 deblock sao
Output #0, avi, to 'compressed_xxx.avi':
 Metadata:
 ISFT : Lavf59.27.100
 Stream #0:0: Video: hevc, yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 29 fps, 29 tbn
 Metadata:
 encoder : Lavc59.37.100 libx265
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp
 Metadata:
 encoder : Lavc59.37.100 libmp3lame
frame=10776 fps= 33 q=36.0 Lsize= 42885kB time=00:06:11.59 bitrate= 945.4kbits/s speed=1.15x
video:36477kB audio:5807kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.422882%
x265 [info]: frame I: 63, Avg QP:26.58 kb/s: 5832.53
x265 [info]: frame P: 3716, Avg QP:28.99 kb/s: 1837.94
x265 [info]: frame B: 6997, Avg QP:35.36 kb/s: 203.80
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.0%
x265 [info]: consecutive B-frames: 2.8% 53.6% 2.0% 39.0% 2.7%

encoded 10776 frames in 322.72s (33.39 fps), 800.22 kb/s, Avg QP:33.11



ffprobe to the result :


Input #0, avi, from 'compressed_xxx.avi':
 Metadata:
 software : Lavf59.27.100
 Duration: 00:06:11.62, start: 0.000000, bitrate: 945 kb/s
 Stream #0:0: Video: rawvideo, bgr24, 1280x720, 804 kb/s, SAR 1:1 DAR 16:9, 29 fps, 29 tbr, 29 tbn
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s

or:

{
 "programs": [

 ],
 "streams": [
 {
 "codec_name": "rawvideo",
 "width": 1280,
 "height": 720,
 "r_frame_rate": "30/1",
 "duration": "371.633333",
 "bit_rate": "792222"
 },
 {
 "codec_name": "aac",
 "sample_rate": "44100",
 "r_frame_rate": "0/0",
 "duration": "371.635374",
 "bit_rate": "128000"
 }
 ]
}



the cedec show like 'rawvideo', not for other video that can correct play, like :


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'compressed_yyy.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf59.27.100
 Duration: 00:32:16.26, start: 0.000000, bitrate: 604 kb/s
 Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 1280x720, 468 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.37.100 libx265
 Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]

or:

{
 "programs": [

 ],
 "streams": [
 {
 "codec_name": "hevc",
 "width": 1280,
 "height": 720,
 "r_frame_rate": "30/1",
 "duration": "1936.233333",
 "bit_rate": "468393"
 },
 {
 "codec_name": "aac",
 "sample_rate": "48000",
 "r_frame_rate": "0/0",
 "duration": "1936.256000",
 "bit_rate": "127151"
 }
 ]
}



does i need any config to specify in ffmpeg commands to get the right codec ?
(btw, does this video bitrate is normally ?)


-
How to send time stamps to ffmpeg when encoding uncompressed video frames via stdin ?
7 août 2023, par SpacyI'm writing a C# application, but this question applies to any programming language.
I know it is possible to pass uncompressed video frames (in yuv420p format) via stdin to ffmpeg.exe, but I recorded these frames to RAM from a webcam that has a variable frame rate. I have the exact time stamps for each frame. How do I send the time stamps to ffmpeg.exe together with the uncompressed frame data ?


I would prefer if it was possible to send them within the stdin byte stream, but I could also provide them up front when invoking ffmpeg.exe (this might become a very long argument list though). I could also write them to a text file on disk if nothing else works.