
Recherche avancée
Autres articles (58)
-
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
Les images
15 mai 2013 -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (5974)
-
Error in converting raw yuv video into mp4
8 décembre 2020, par neetu siggerI am trying to convert raw yuv video into mp4 using ffmpeg.


ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i Beauty_3840x2160_120fps_420_10bit_YUV.yuv -c:v libx264 -preset slow -qp 0 bb/output.mp4



I got an error in video.


ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i Beauty_3840x2160_120fps_420_10bit_YUV.yuv -c:v libx264 -preset slow -qp 0 bb/output.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
 configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100
[rawvideo @ 0x7fffe7e28440] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'Beauty_3840x2160_120fps_420_10bit_YUV.yuv':
 Duration: 00:03:12.00, start: 0.000000, bitrate: 622080 kb/s
 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc
File 'bb/output.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x7fffe7e35c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fffe7e35c00] profile High 4:4:4 Predictive, level 5.0, 4:2:0 8-bit
[libx264 @ 0x7fffe7e35c00] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=8 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to 'bb/output.mp4':
 Metadata:
 encoder : Lavf58.29.100
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 25 fps, 12800 tbn, 25 tbc
 Metadata:
 encoder : Lavc58.54.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 4800 fps= 16 q=-1.0 Lsize=11907234kB time=00:03:11.96 bitrate=508147.7kbits/s speed=0.646x
video:11907177kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000485%
[libx264 @ 0x7fffe7e35c00] frame I:2789 Avg QP: 0.00 size:2638070
[libx264 @ 0x7fffe7e35c00] frame P:2011 Avg QP: 0.00 size:2404461
[libx264 @ 0x7fffe7e35c00] mb I I16..4..PCM: 28.0% 0.0% 67.1% 4.9%
[libx264 @ 0x7fffe7e35c00] mb P I16..4..PCM: 5.6% 0.0% 6.2% 0.6% P16..4: 52.9% 23.9% 10.8% 0.0% 0.0% skip: 0.0%
[libx264 @ 0x7fffe7e35c00] 8x8 transform intra:0.0% inter:9.6%
[libx264 @ 0x7fffe7e35c00] coded y,uvDC,uvAC intra: 99.4% 100.0% 100.0% inter: 100.0% 100.0% 100.0%
[libx264 @ 0x7fffe7e35c00] i16 v,h,dc,p: 89% 0% 1% 10%
[libx264 @ 0x7fffe7e35c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 65% 0% 0% 0% 0% 0% 0% 0% 35%
[libx264 @ 0x7fffe7e35c00] i8c dc,h,v,p: 1% 0% 94% 4%
[libx264 @ 0x7fffe7e35c00] Weighted P-Frames: Y:31.1% UV:29.3%
[libx264 @ 0x7fffe7e35c00] ref P L0: 21.3% 16.1% 27.4% 14.4% 11.7% 5.5% 3.6%



I am getting the green video.




-
video generation using ffmpeg
10 mai 2012, par JackI am trying to generate video from set of image using ffmpeg library. Using following code, I am able to generate the video on simulator but when I run it on device, it produces strange green effect in video. I followed Encoding images to video with ffmpeg url. Can anybody help me out or if can provide code snippet, will be really appreciated.
//here is the code..
(void)createVideoFromImages
{
NSString *fileName2 = [Utilities documentsPath:[NSString stringWithFormat:@"test.mov"]];
NSLog(@"filename: %@",fileName2);
//Register all formats and codecs
AVCodec *codec;
//avcodec_register_all();
//avdevice_register_all();
av_register_all();
AVCodecContext *c= NULL;
int i, out_size, size, outbuf_size;
FILE *f;
AVFrame *picture;
uint8_t *outbuf;
printf("Video encoding\n");
/* find the mpeg video encoder */
codec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
if (!codec)
{
fprintf(stderr, "codec not found\n");
exit(1);
}
c= avcodec_alloc_context();
picture= avcodec_alloc_frame();
/* put sample parameters */
c->bit_rate = 400000;
/* resolution must be a multiple of two */
c->width = 256;
c->height = 256;//258;
/* frames per second */
c->time_base= (AVRational){1,25};
c->gop_size = 10; /* emit one intra frame every ten frames */
c->max_b_frames=1;
c->pix_fmt = PIX_FMT_YUV420P;//PIX_FMT_YUV420P;
/* open it */
if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
const char* filename_cstr = [fileName2 cStringUsingEncoding:NSUTF8StringEncoding];
f = fopen(filename_cstr, "wb");
if (!f) {
fprintf(stderr, "could not open %s\n", fileName2);
exit(1);
}
/* alloc image and output buffer */
outbuf_size = 100000;
outbuf = malloc(outbuf_size);
size = c->width * c->height;
#pragma mark -
AVFrame* outpic = avcodec_alloc_frame();
int nbytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height);
NSLog(@"bytes: %d",nbytes);
//create buffer for the output image
uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes);
for(i=100;i<104;i++)
{
fflush(stdout);
int numBytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height);
NSLog(@"numBytes: %d",numBytes);
uint8_t *buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
UIImage *image;
image = [UIImage imageWithContentsOfFile:[Utilities bundlePath:[NSString stringWithFormat:@"%d.png",i]]];
/*
if(i>=98)//for video images
{
NSLog(@"i: %d",i);
image = [UIImage imageWithContentsOfFile:[Utilities documentsPath:[NSString stringWithFormat:@"image0098.png"]]]; ///@"image0098.png"]];
//[NSString stringWithFormat:@"%d.png", i]];
}
else //for custom image
{
image = [UIImage imageWithContentsOfFile:[Utilities bundlePath:[NSString stringWithFormat:@"image%04d.png", i]]];
//[UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]];//@"image%04d.png",i]];
}*/
CGImageRef newCgImage = [image CGImage];
NSLog(@"No. of Bits per component: %d",CGImageGetBitsPerComponent([image CGImage]));
NSLog(@"No. of Bits per pixel: %d",CGImageGetBitsPerPixel([image CGImage]));
NSLog(@"No. of Bytes per row: %d",CGImageGetBytesPerRow([image CGImage]));
CGDataProviderRef dataProvider = CGImageGetDataProvider(newCgImage);
CFDataRef bitmapData = CGDataProviderCopyData(dataProvider);
buffer = (uint8_t *)CFDataGetBytePtr(bitmapData);
struct SwsContext* fooContext;
avpicture_fill((AVPicture*)picture, buffer, PIX_FMT_RGBA, c->width, c->height);
avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, c->height);
fooContext= sws_getContext(c->width, c->height,
PIX_FMT_RGBA,
c->width, c->height,
PIX_FMT_YUV420P,
SWS_FAST_BILINEAR , NULL, NULL, NULL);
//}
//perform the conversion
NSLog(@"linesize: %d", picture->linesize[0]);
sws_scale(fooContext, picture->data, picture->linesize, 0, c->height, outpic->data, outpic->linesize);
// Here is where I try to convert to YUV
/* encode the image */
out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic);
printf("encoding frame %d (size=%d)\n", i, out_size);
fwrite(outbuf, 1, out_size, f);
NSLog(@"%d",sizeof(f));
free(buffer);
buffer = NULL;
}
/* get the delayed frames */
for( ; out_size; i++)
{
fflush(stdout);
out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
printf("write frame %3d (size=%5d)\n", i, out_size);
fwrite(outbuf, 1, outbuf_size, f);
}
/* add sequence end code to have a real mpeg file */
outbuf[0] = 0x00;
outbuf[1] = 0x00;
outbuf[2] = 0x01;
outbuf[3] = 0xb7;
fwrite(outbuf, 1, 4, f);
fclose(f);
free(outbuf);
avcodec_close(c);
av_free(c);
av_free(picture);
printf("\n");
} -
Need help configuring FFMPEG to work with a webcams h264 stream
9 août 2020, par The Welsh DragonI have been trying to get a H264 stream from a H264 usb webcam working but I am not making much progress so I'm hoping someone knows FFMPEG better than me !


There are dozens of questions/answers on SO but none solve my problem.


In short, I get a very pixelated (or sometimes mostly green) screen. I am using VLC to test the stream which is coming via an RTSP server. I am using FFMPEG to copy the webcam stream to the local RTSP server.


The webcam also supports YUYV which I can get working - it is just the h264 stream causing me problems.


So this is how the device is presented :


H264 USB Camera: USB Camera (usb-20980000.usb-1):
 /dev/video0
 /dev/video1
 /dev/video2
 /dev/video3



/dev/video0 is the YUYV and MPEG stream
/dev/video2 is the h264 stream that has the following capabilities :


ioctl: VIDIOC_ENUM_FMT
 Type: Video Capture

 [0]: 'H264' (H.264, compressed)
 Size: Discrete 1920x1080
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 1280x720
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 800x600
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 640x480
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 640x360
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 352x288
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 320x240
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Size: Discrete 1920x1080
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)
 Interval: Discrete 0.033s (30.000 fps)
 Interval: Discrete 0.040s (25.000 fps)
 Interval: Discrete 0.067s (15.000 fps)



I have tried various resolutions, the smaller giving slightly less pixelated images but none are usable and definitely dont compare to the YUYV high resolution results.


This (YUYV) command works :


ffmpeg -input_format yuyv422 -f video4linux2 -s 1280x720 -r 10 -i /dev/video0 -c:v h264_omx -r 10 -b:v 2M -an -f rtsp rtsp://localhost:80/live/stream



These two h264 options dont work :


ffmpeg -input_format h264 -f video4linux2 -video_size 1920x1080 -framerate 30 -i /dev/video0 -c:v copy -an -f rtsp rtsp://localhost:80/live/stream



ffmpeg -re -i /dev/video2 -video_size 800x600 -framerate 15 -pix_fmt yuv420p -tune zerolatency -c:v copy -an -f rtsp rtsp://localhost:80/live/stream



For that last command the FFMPEG output looks like this :


ffmpeg version git-2020-08-07-6fdf3cc Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 8 (Raspbian 8.3.0-6+rpi1)
 configuration: --extra-ldflags=-latomic --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree --enable-libfreetype --enable-libx264 --enable-libmp3lame --enable-mmal --enable-indev=alsa --enable-outdev=alsa
 libavutil 56. 58.100 / 56. 58.100
 libavcodec 58.100.100 / 58.100.100
 libavformat 58. 50.100 / 58. 50.100
 libavdevice 58. 11.101 / 58. 11.101
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
 libpostproc 55. 8.100 / 55. 8.100
Input #0, video4linux2,v4l2, from '/dev/video2':
 Duration: N/A, start: 1353.265049, bitrate: N/A
 Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 2000k tbc
[udp @ 0x38c29f0] attempted to set receive buffer to size 393216 but it only ended up set as 360448
[udp @ 0x38d7b50] attempted to set receive buffer to size 393216 but it only ended up set as 360448
Output #0, rtsp, to 'rtsp://localhost:80/live/stream':
 Metadata:
 encoder : Lavf58.50.100
 Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn, 1000k tbc
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[rtsp @ 0x38fd890] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[rtsp @ 0x38fd890] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
frame= 348 fps= 18 q=-1.0 size=N/A time=00:00:21.03 bitrate=N/A speed=1.09x



The issue looks like it is bandwidth related or the lack of processing power in the device being used BUT the YUYV works at a high resolution and (taking a completely different approach i.e. not using FFMPEG) I can get a very decent MPEG stream working on the same device.


So any FFMPEG experts out there who can help me with getting the correct parameters for a h264 stream ?