Recherche avancée

Médias (1)

Mot : - Tags -/framasoft

Autres articles (111)

  • Les formats acceptés

    28 janvier 2010, par

    Les 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 (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9073)

  • How to send ffmpeg AVPacket through WebRTC (using libdatachannel)

    14 novembre 2022, par mike

    I'm encoding a video frame with the ffmpeg libraries, generating an AVPacket with compressed data.

    


    Thanks to some recent advice here on S/O, I am trying to send that frame over a network using the WebRTC library libdatachannel, specifically by adapting the example here :

    


    https://github.com/paullouisageneau/libdatachannel/tree/master/examples/streamer

    


    I am seeing problems inside h264rtppacketizer.cpp (part of the library, not the example) which are almost certainly to do with how I'm providing the sample data.
(I don't think that this is anything to do with libdatachannel specifically, it will be an issue with what I'm sending)

    


    The example code reads each encoded frame from a file, and populates a sample by setting the content of the file to the contents of the file :

    


    sample = *reinterpret_cast *>(&fileContents);

    


    sample is just a std::vector<byte>;</byte>

    &#xA;

    I have naively copied the contents of an AVPacket->data pointer into the sample vector :

    &#xA;

    sample.resize(pkt->size);&#xA;memcpy(sample.data(), pkt->data, pkt->size * sizeof(std::byte));    &#xA;

    &#xA;

    but the packetizer is falling over when trying to get length values out of that data.&#xA;Specifically, in the following code, the first iteration gets a length of 1, but the second, looking up index 5, gives 1119887324. This is way too big for my data, which is only 3526 bytes (the whole frame is a single colour so likely to be small once encoded) :

    &#xA;

    while (index &lt; message->size()) {&#xA;assert(index &#x2B; 4 &lt; message->size());&#xA;auto lengthPtr = (uint32_t *)(message->data() &#x2B; index);&#xA;uint32_t length = ntohl(*lengthPtr);&#xA;auto naluStartIndex = index &#x2B; 4;&#xA;auto naluEndIndex = naluStartIndex &#x2B; length;&#xA;assert(naluEndIndex &lt;= message->size());    &#xA;        &#xA;auto begin = message->begin() &#x2B; naluStartIndex;&#xA;auto end = message->begin() &#x2B; naluEndIndex;&#xA;nalus->push_back(std::make_shared<nalunit>(begin, end));&#xA;index = naluEndIndex;&#xA;}&#xA;</nalunit>

    &#xA;

    Here is a dump of

    &#xA;

    uint32_t length = ntohl(*lengthPtr);&#xA;

    &#xA;

    for the first few elements of the message (*lengthPtr in parentheses) :

    &#xA;

    [2022-03-29 15:12:01.182] [info] index 0: 1  (16777216)&#xA;[2022-03-29 15:12:01.183] [info] index 1: 359  (1728118784)&#xA;[2022-03-29 15:12:01.184] [info] index 2: 91970  (1114046720)&#xA;[2022-03-29 15:12:01.186] [info] index 3: 23544512  (3225577217)&#xA;[2022-03-29 15:12:01.186] [info] index 4: 1732427807  (532693607)&#xA;[2022-03-29 15:12:01.187] [info] index 5: 1119887324  (3693068354)&#xA;[2022-03-29 15:12:01.188] [info] index 6: 3223313413  (98312128)&#xA;[2022-03-29 15:12:01.188] [info] index 7: 534512896  (384031)&#xA;[2022-03-29 15:12:01.188] [info] index 8: 3691315291  (1526728156)&#xA;[2022-03-29 15:12:01.189] [info] index 9: 83909537  (2707095557)&#xA;[2022-03-29 15:12:01.189] [info] index 10: 6004992  (10574592)&#xA;[2022-03-29 15:12:01.190] [info] index 11: 1537277952  (41307)&#xA;[2022-03-29 15:12:01.190] [info] index 12: 2701131779  (50331809)&#xA;[2022-03-29 15:12:01.192] [info] index 13: 768  (196608)&#xA;

    &#xA;

    (I know I should post a complete sample, I am working on it)

    &#xA;

      &#xA;
    • I am fairly sure I am just missing something basic. E.g. am I supposed to do something with the AVPacket side_data, does AVPacket have or miss some header info ?

      &#xA;

    • &#xA;

    • If I just fwrite the pkt->data for a single frame to disk, I can read the codec information with ffprobe :

      &#xA;

    • &#xA;

    &#xA;

    Input #0, h264, from &#x27;encodedOut.h264&#x27;:&#xA;Duration: N/A, bitrate: N/A&#xA;Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720, 30 tbr, 1200k tbn&#xA;

    &#xA;

    Update : This issue is solved by changing the H264RtpPacketizer separator setting from H264RtpPacketizer::Separator::Length to H264RtpPacketizer::Separator::LongStartSequence, many thanks to author of libdatachannel paullouisageneau (see answer below)

    &#xA;

    I have issues related to settings for the libx264 encoder, but can happily encode with h264_nvenc and h264_mf

    &#xA;

  • How correctly show video with transparency in Qt with OpenCV + FFMpeg

    11 avril 2022, par TheEnigmist

    I'm trying to show a video with transparency in a Qt6 application using OpenCV + FFMPEG.&#xA;Actually those are tool versions :

    &#xA;

      &#xA;
    • Win 11
    • &#xA;

    • Qt 6.3.0
    • &#xA;

    • OpenCV 4.5.5 (built with CMake)
    • &#xA;

    • FFMPEG 2022-04-03-git-1291568c98-full_build-www.gyan.dev
    • &#xA;

    &#xA;

    I've used a base .mov video with transparency as test (link provided below).&#xA;First of all I've converted .mov video to .webm video (VP9) and I see in output text that alpha channel remains

    &#xA;

    &#xA;

    ffmpeg -i '.\Retro Bars.mov' -c:v libvpx-vp9 -crf 30 -b:v 0 output.webm

    &#xA;

    &#xA;

    Input #0, mov,mp4,m4a,3gp,3g2,mj2,&#xA;    ...&#xA;    Stream #0:0[0x1](eng): Video: qtrle (rle  / 0x20656C72), argb(progressive),&#xA;    ...&#xA;&#xA;Output #0, webm, &#xA;   ...&#xA;   Stream #0:0(eng): Video: vp9, yuva420p(tv, progressive),&#xA;   ...&#xA;

    &#xA;

    But when I show info of output file with ffmpeg it loses alpha channel :

    &#xA;

    &#xA;

    ffmpeg -i .\output.webm

    &#xA;

    &#xA;

    Input #0, matroska,webm,&#xA;    ...&#xA;    Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, progressive),&#xA;    ...&#xA;

    &#xA;

    If I open output.webm with OBS it is shown correctly without a background, as shown in picture :&#xA;obs_load

    &#xA;

    If I try to open it with OpenCV + FFMPEG it shows a black background under bars, as shown in picture :&#xA;Qt_out

    &#xA;

    This is how I load video in Qt :

    &#xA;

    cv::VideoCapture capture;&#xA;capture.open(filename, cv::CAP_FFMPEG);&#xA;capture.set(cv::CAP_PROP_CONVERT_RGB, false); // try forcing load alpha channel&#xA;... //in a thread&#xA;while (capture.read(frame)) {&#xA;    qDebug() &lt;&lt; "c" &lt;&lt; frame.channels() &lt;&lt; "t" &lt;&lt;  frame.type() &lt;&lt; "d" &lt;&lt;  frame.depth(); // output: c 3 t 16 d 0&#xA;    cv::cvtColor(frame, frame, cv::COLOR_BGR2RGBA); //useless since no alpha channel is detected&#xA;    img = QImage(frame.data, frame.cols, frame.rows, QImage::Format_RGBA8888);&#xA;    emit processedImage(img); // to show image in a QLabel with QPixmap::fromImage(img)&#xA;}&#xA;

    &#xA;

    I think the problem is when I load the video with OpenCV, it doens't detect alpha channel, since I can load correctly in other player (obs, html5, etc.)

    &#xA;

    What I'm wrong with all process to show this video in Qt with transparency ?

    &#xA;

    EDIT : Added dropbox link with test video + ffmpeg outputs :&#xA;sample items

    &#xA;

  • FFMpeg crop a portrait (vertical) video square 1:1

    1er avril 2022, par hugger

    SOLVED... It was a UI issue... Not an FFpeg issue.

    &#xA;

    I am new to FFMpeg. I am stuck on cropping a portrait video taken from a portrait device square.

    &#xA;

    I would like my video output to be 1080x1080.

    &#xA;

    First, I tried this.

    &#xA;

    FFmpegKit.execute(`-y -i ${media.path} -vf "crop=1080:1080:exact=1" ${path}`)&#xA;

    &#xA;

    As I hoped, this worked for photos. (but strangely rotates the photo) - looking into that...

    &#xA;

    BUT, for videos it does not work. instead it turns the video landscape.

    &#xA;

    I then tried to add scale :

    &#xA;

    FFmpegKit.execute(`-y -i ${media.path} -vf "crop=1080:1080:exact=1, scale=1080:1080" ${path}`)&#xA;

    &#xA;

    But this left me with the same result.

    &#xA;

    Here are the console logs for some more information :

    &#xA;

     LOG  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;file:///private/var/mobile/Containers/Data/Application/71E462FC-4824-41FE-B28D-57AF7B6078C3/tmp/ReactNative/329ACC6F-42B6-4B12-A289-889DADE1BC3A.mov&#x27;:&#xA; LOG    Metadata:&#xA; LOG      major_brand     :&#xA; LOG  qt&#xA; LOG  &#xA; LOG      minor_version   :&#xA; LOG  0&#xA; LOG  &#xA; LOG      compatible_brands:&#xA; LOG  qt&#xA; LOG  &#xA; LOG      creation_time   :&#xA; LOG  2022-04-01T03:41:12.000000Z&#xA; LOG  &#xA; LOG    Duration:&#xA; LOG  00:00:02.35&#xA; LOG  , start:&#xA; LOG  0.000000&#xA; LOG  , bitrate:&#xA; LOG  21200 kb/s&#xA; LOG  &#xA; LOG    Stream #0:0&#xA; LOG  [0x1]&#xA; LOG  (und)&#xA; LOG  : Video: hevc (hvc1 / 0x31637668), yuv420p(tv, bt709), 1080x1920, 21140 kb/s&#xA; LOG  ,&#xA; LOG  59.96 fps,&#xA; LOG  59.94 tbr,&#xA; LOG  600 tbn&#xA; LOG   (default)&#xA; LOG  &#xA; LOG      Metadata:&#xA; LOG        creation_time   :&#xA; LOG  2022-04-01T03:41:13.000000Z&#xA; LOG  &#xA; LOG        handler_name    :&#xA; LOG  Core Media Video&#xA; LOG  &#xA; LOG        vendor_id       :&#xA; LOG  [0][0][0][0]&#xA; LOG  &#xA; LOG        encoder         :&#xA; LOG  HEVC&#xA; LOG  &#xA; LOG    Stream #0:1&#xA; LOG  [0x2]&#xA; LOG  (und)&#xA; LOG  : Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 61 kb/s&#xA; LOG   (default)&#xA; LOG  &#xA; LOG      Metadata:&#xA; LOG        creation_time   :&#xA; LOG  2022-04-01T03:41:13.000000Z&#xA; LOG  &#xA; LOG        handler_name    :&#xA; LOG  Core Media Audio&#xA; LOG  &#xA; LOG        vendor_id       :&#xA; LOG  [0][0][0][0]&#xA; LOG  &#xA; LOG  [hevc @ 0x118ce07d0] The "sub_text_format" option is deprecated: Deprecated, does nothing&#xA; LOG  [aac @ 0x10d30e190] The "sub_text_format" option is deprecated: Deprecated, does nothing&#xA; LOG  Stream mapping:&#xA; LOG    Stream #0:0 -> #0:0&#xA; LOG   (hevc (native) -> mpeg4 (native))&#xA; LOG  &#xA; LOG    Stream #0:1 -> #0:1&#xA; LOG   (aac (native) -> aac (native))&#xA; LOG  &#xA; LOG  Press [q] to stop, [?] for help&#xA; LOG  Output #0, mp4, to &#x27;/var/mobile/Containers/Data/Application/71E462FC-4824-41FE-B28D-57AF7B6078C3/Documents/after.mp4&#x27;:&#xA; LOG    Metadata:&#xA; LOG      major_brand     :&#xA; LOG  qt&#xA; LOG  &#xA; LOG      minor_version   :&#xA; LOG  0&#xA; LOG  &#xA; LOG      compatible_brands:&#xA; LOG  qt&#xA; LOG  &#xA; LOG      encoder         :&#xA; LOG  Lavf59.10.100&#xA; LOG  &#xA; LOG    Stream #0:0&#xA; LOG  (und)&#xA; LOG  : Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, bt709, progressive), 1080x1080, q=2-31, 10000 kb/s&#xA; LOG  ,&#xA; LOG  59.94 fps,&#xA; LOG  60k tbn&#xA; LOG   (default)&#xA; LOG  &#xA; LOG      Metadata:&#xA; LOG        creation_time   :&#xA; LOG  2022-04-01T03:41:13.000000Z&#xA; LOG  &#xA; LOG        handler_name    :&#xA; LOG  Core Media Video&#xA; LOG  &#xA; LOG        vendor_id       :&#xA; LOG  [0][0][0][0]&#xA; LOG  &#xA; LOG        encoder         :&#xA; LOG  Lavc59.15.102 mpeg4&#xA; LOG  &#xA; LOG      Side data:&#xA; LOG  &#xA; LOG  cpb:&#xA; LOG  bitrate max/min/avg: 0/0/10000000 buffer size: 0&#xA; LOG  vbv_delay: N/A&#xA; LOG  &#xA; LOG    Stream #0:1&#xA; LOG  (und)&#xA; LOG  : Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s&#xA; LOG   (default)&#xA; LOG  &#xA; LOG      Metadata:&#xA; LOG        creation_time   :&#xA; LOG  2022-04-01T03:41:13.000000Z&#xA; LOG  &#xA; LOG        handler_name    :&#xA; LOG  Core Media Audio&#xA; LOG  &#xA; LOG        vendor_id       :&#xA; LOG  [0][0][0][0]&#xA; LOG  &#xA; LOG        encoder         :&#xA; LOG  Lavc59.15.102 aac&#xA; LOG  &#xA; LOG  frame=    1 fps=0.0 q=3.6 size=       0kB time=00:00:01.06 bitrate=   0.3kbits/s speed=9.23x&#xA; LOG  frame=   47 fps=0.0 q=2.0 size=     768kB time=00:00:01.85 bitrate=3390.0kbits/s speed=3.01x&#xA; LOG  frame=   95 fps= 81 q=2.2 size=    1792kB time=00:00:02.32 bitrate=6313.3kbits/s speed=1.99x&#xA; LOG  frame=  129 fps= 77 q=2.5 size=    2560kB time=00:00:02.32 bitrate=9018.9kbits/s speed=1.39x&#xA; LOG  frame=  139 fps= 78 q=2.6 Lsize=    2953kB time=00:00:02.38 bitrate=10124.6kbits/s speed=1.34x&#xA; LOG  video:2929kB audio:20kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:&#xA; LOG  0.136336%&#xA; LOG  &#xA; LOG  [aac @ 0x112820f50] Qavg: 113.412&#xA; LOG  COMPLETED&#xA; LOG  {}&#xA;

    &#xA;

    This is the result, when i replace&#xA;-i {media} with&#xA;-f lavfi -i smptebars=r=60000/1001:s=1080x1920:d=1

    &#xA;

    enter image description here

    &#xA;

    ALMOST but not 1:1...

    &#xA;

    I have not had any luck online trying to find a solution for this so I have decided to post on here.

    &#xA;

    I hope I can get some guidance here !

    &#xA;

    Cheers.

    &#xA;