
Recherche avancée
Autres articles (53)
-
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
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 (...)
Sur d’autres sites (12204)
-
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 ?)


-
what is the correct command using gstreamer to convert mp4 to 264 file ?
25 mars 2020, par hilowMy english is pool, i am sorry !
I use ffmpeg and gstreamer convert mp4 file to 264 format, but the output file is different.
The question is :-
1.Why they are different file ?
-
2.What is the
level
mean ingst-discoverer-1.0
?Use ffmpeg it is
Codec: video/x-h264, ...... level=(string)1.2
.Use gstreamer it is
Codec: video/x-h264, ...... level=(string)3
. -
3.How to use gstreamer to convert the correct 264 file ?
The original video file is come from https://github.com/notedit/media-server-go-demo/blob/master/video-mixer/public/big_buck_bunny.mp4 .
command :
gst-launch-1.0 filesrc location=big_buck_bunny.mp4 ! \
qtdemux name=demux \
demux.video_0 ! queue ! \
decodebin ! \
videoconvert ! \
videoscale ! \
videorate ! \
video/x-raw,width=320,height=240,framerate=15/1,pixel-aspect-ratio=1/1,level=1.2 ! \
x264enc bframes=0 byte-stream=true bitrate=9000 ! \
filesink location=videogst.264
ffmpeg -i big_buck_bunny.mp4 -f h264 -vcodec libx264 -s 320x240 -bf 0 -r 15 videoffmpeg.264output file :
-rw-r--r-- 1 xxx staff 1.9M 3 25 13:39 videoffmpeg.264
-rw-r--r-- 1 xxx staff 17M 3 25 13:40 videogst.264video codec :
xxx@xxxs-MacBook-Pro resource % gst-discoverer-1.0 videoffmpeg.264 -v
Analyzing file:///Users/xxx/tool/resource/videoffmpeg.264
Done discovering file:///Users/xxx/tool/resource/videoffmpeg.264
Topology:
video: video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
Tags:
视频编码: H.264 (High Profile)
Codec:
video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
Additional info:
None
Stream ID: 349989c8845fcc23360fb0ab02ea7510051b926669bf8f3862879823fbab6daf
Width: 320
Height: 240
Depth: 24
Frame rate: 15/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
Properties:
Duration: 0:01:32.995000000
Seekable: yes
Live: no
Tags:
视频编码: H.264 (High Profile)
xxx@xxxs-MacBook-Pro resource % gst-discoverer-1.0 videogst.264 -v
Analyzing file:///Users/xxx/tool/resource/videogst.264
Done discovering file:///Users/xxx/tool/resource/videogst.264
Topology:
video: video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
Tags:
视频编码: H.264 (High Profile)
Codec:
video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
Additional info:
None
Stream ID: fb99f4104b347e5682d52c0bd65bcee91b765e42f89ce2e3553be5d6d743a666
Width: 320
Height: 240
Depth: 24
Frame rate: 15/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
Properties:
Duration: 0:01:45.505000000
Seekable: yes
Live: no
Tags:
视频编码: H.264 (High Profile) -
-
How to use FFMPEG API to decode to client allocated memory
25 mars 2020, par VorpalSwordI’m trying to use the FFMPEG API to decode into a buffer defined by the client program by following the tips in this question but using the new pattern for decoding instead of the now deprecated
avcodec_decode_video2
function.If my input file is an I-frame only format, everything works great. I’ve tested with a .mov file encoded with v210 (uncompressed).
However, if the input is a long-GoP format (I’m trying with H.264 high profile 4:2:2 in an mp4 file) I get the following pleasingly psychedelic/impressionistic result :
There’s clearly something motion-vectory going on here !
And if I let FFMPEG manage its own buffers with the H.264 input by not overriding
AVCodecContext::get_buffer2
, I can make a copy from the resulting frame to my desired destination buffer and get good results.Here’s my decoder method,
_frame
and_codecCtx
are object members of typeAVFrame*
andAVCodecContext*
respectively. They get alloc’d and init’d in the constructor.virtual const DecodeResult decode(const rv::sz_t toggle) override {
_toggle = toggle & 1;
using Flags_e = DecodeResultFlags_e;
DecodeResult ans(Flags_e::kNoResult);
AVPacket pkt; // holds compressed data
::av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
int ret;
// read the compressed frame to decode
_err = av_read_frame(_fmtCtx, &pkt);
if (_err < 0) {
if (_err == AVERROR_EOF) {
ans.set(Flags_e::kEndOfFile);
_err = 0; // we can safely ignore EOF errors
return ans;
} else {
baleOnFail(__PRETTY_FUNCTION__);
}
}
// send (compressed) packets to the decoder until it produces an uncompressed frame
do {
// sender
_err = ::avcodec_send_packet(_codecCtx, &pkt);
if (_err < 0) {
if (_err == AVERROR_EOF) {
_err = 0; // EOFs are ok
ans.set(Flags_e::kEndOfFile);
break;
} else {
baleOnFail(__PRETTY_FUNCTION__);
}
}
// receiver
ret = ::avcodec_receive_frame (_codecCtx, _frame);
if (ret == AVERROR(EAGAIN)) {
continue;
} else if (ret == AVERROR_EOF) {
ans.set(Flags_e::kEndOfFile);
break;
} else if (ret < 0) {
_err = ret;
baleOnFail(__PRETTY_FUNCTION__);
} else {
ans.set(Flags_e::kGotFrame);
}
av_packet_unref (&pkt);
} while (!ans.test(Flags_e::kGotFrame));
//packFrame(); <-- used to copy to client image
return ans;
}And here’s my override for
get_buffer2
int getVideoBuffer(struct AVCodecContext* ctx, AVFrame* frm) {
// ensure frame pointers are all null
if (frm->data[0] || frm->data[1] || frm->data[2] || frm->data[3]){
::strncpy (_errMsg, "non-null frame data pointer detected.", AV_ERROR_MAX_STRING_SIZE);
return -1;
}
// get format descriptor, ensure it's valid.
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(static_cast<avpixelformat>(frm->format));
if (!desc) {
::strncpy (_errMsg, "Pixel format descriptor not available.", AV_ERROR_MAX_STRING_SIZE);
return AVERROR(EINVAL);
}
// for Video, extended data must point to the same place as data.
frm->extended_data = frm->data;
// set the data pointers to point at the Image data.
int chan = 0;
IMG* img = _imgs[_toggle];
// initialize active channels
for (; chan < 3; ++chan) {
frm->buf[chan] = av_buffer_create (
static_cast(img->begin(chan)),
rv::unsigned_cast<int>(img->size(chan)),
Player::freeBufferCallback, // callback does nothing
reinterpret_cast(this),
0 // i.e. AV_BUFFER_FLAG_READONLY is not set
);
frm->linesize[chan] = rv::unsigned_cast<int>(img->stride(chan));
frm->data[chan] = frm->buf[chan]->data;
}
// zero out inactive channels
for (; chan < AV_NUM_DATA_POINTERS; ++chan) {
frm->data[chan] = NULL;
frm->linesize[chan] = 0;
}
return 0;
}
</int></int></avpixelformat>I can reason that the codec needs to keep reference frames in memory and so I’m not really surprised that this isn’t working, but I’ve not been able to figure out how to have it deliver clean decoded frames to client memory. I thought that
AVFrame::key_frame
would have been a clue, but, after observing its behaviour in gdb, it doesn’t provide a useful trigger for when to allocateAVFrame::buf
s from the buffer pool and when they can be initialized to point at client memory.Grateful for any help !