
Recherche avancée
Médias (91)
-
Head down (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Echoplex (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Discipline (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Letting you (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
1 000 000 (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
999 999 (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (27)
-
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 -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)
Sur d’autres sites (5682)
-
ffmpeg generate thumbnails on GPU
22 juin 2018, par Oleksandr KyrpaI try to generate thumbnails with acceleration on GPU, so compile ffmpeg 3.4.1 and run command :
./ffmpeg -i ~/Videos/1080.mp4 -vf "hwupload_cuda,thumbnail_cuda=100,scale_cuda=107:60,hwdownload,format=yuv420p" -vframes 1 -y ~/Videos/thumbs/thumb%03d.jpg
But I get wrong output picture (the color of thumbnail is green) :
Correct image must be black.
How to make first image with correct color ?log : -loglevel verbose
ffmpeg version N-89707-g89b84cb Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --cpu=native --enable-pthreads --extra-version=hd --enable-gnutls --enable-vaapi --enable-vdpau --enable-nonfree --enable-gpl --enable-swscale --enable-libx264 --enable-version3 --enable-nvenc --enable-libnpp --enable-cuda --enable-cuvid --enable-cuda-sdk --enable-filter=scale_cuda --enable-filter=thumbnail_cuda --extra-cflags=-I/usr/local/cuda-8.0/include --extra-ldflags=-L/usr/local/cuda-8.0/lib64
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 11.100 / 7. 11.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
[h264 @ 0x392ed40] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/alex/Videos/1080.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2012-05-30T20:01:34.000000Z
Duration: 00:01:14.21, start: 0.000000, bitrate: 5476 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088), 5321 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 152 kb/s (default)
Metadata:
creation_time : 2012-05-30T20:01:34.000000Z
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[h264 @ 0x3a38280] Reinit context to 1920x1088, pix_fmt: yuv420p
[Parsed_thumbnail_cuda_1 @ 0x4e3d8c0] batch size: 100 frames
[graph 0 input from stream 0:0 @ 0x4e8b640] w:1920 h:1080 pixfmt:yuv420p tb:1/60000 fr:30000/1001 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x4e8ca00] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x4e8b540] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_format_4' and the filter 'format'
[Parsed_scale_cuda_2 @ 0x4e89380] w:1920 h:1080 -> w:107 h:60
[swscaler @ 0x4ebf0c0] deprecated pixel format used, make sure you did set range correctly
[auto_scaler_0 @ 0x4e8ca00] w:107 h:60 fmt:yuv420p sar:0/1 -> w:107 h:60 fmt:yuvj420p sar:0/1 flags:0x4
Output #0, image2, to '/home/alex/Videos/thumbs/thumb%03d.jpg':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.3.100
Stream #0:0(und): Video: mjpeg, 1 reference frame, yuvj420p(pc, left), 107x60, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
encoder : Lavc58.9.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[Parsed_thumbnail_cuda_1 @ 0x4e3d8c0] frame id #76 (pts_time=2.535867) selected from a set of 100 images
No more output streams to write to, finishing.
frame= 1 fps=0.9 q=3.1 Lsize=N/A time=00:00:02.56 bitrate=N/A speed=2.26x
video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (/home/alex/Videos/1080.mp4):
Input stream #0:0 (video): 115 packets read (134655 bytes); 101 frames decoded;
Input stream #0:1 (audio): 1 packets read (9 bytes);
Total: 116 packets (134664 bytes) demuxed
Output file #0 (/home/alex/Videos/thumbs/thumb%03d.jpg):
Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (1864 bytes);
Total: 1 packets (1864 bytes) muxedUPDATE, working !
Add format=nv12 before hwupload-vf "format=nv12,hwupload_cuda,thumbnail_cuda,scale_cuda=1280:720,hwdownload,format=nv12"
-
How can I fix video processing and 500 Error - (Laravel, FFmpeg)
19 juillet 2019, par San Martín Figueroa PabloI’m setting up a new website with Laravel for uploading videos...
I have read all the possible solutions but none of them help me to solve the issue...This is my issue : When I upload a small file (<10mb) the web works fine, the video get uploaded and the video get converted, the dashboard shows the converted videos---
When I try to upload a large file, the file get uploaded, the video get converted with a green frame on it (really uggly) and the site goes to a 500 server error...
I’m using Laravel Jobs to do the conversion.
My Controller code :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\Response;
use Carbon;
use Closure;
use App\Jobs\ConvertVideoForPreview;
use FFMpeg\FFProbe;
use FFMpeg\Coordinate\Dimension;
use FFMpeg\Format\Video\X264;
use Pawlox\VideoThumbnail\Facade\VideoThumbnail;
use Pbmedia\LaravelFFMpeg\FFMpegFacade as FFMpeg;
use Illuminate\Contracts\Filesystem\Filesystem;
use App\Video;
class VideoController extends Controller
{
public function createVideo(){
return view('video.createVideo');
}
public function saveVideo(Request $request){
set_time_limit(0);
ini_set('memory_limit', '1024M');
//Validar Formulario
$validatedData = $this -> validate($request, [
'title' => 'required',
'description' => 'required',
'palabras' => 'required',
'video' => 'mimetypes:video/mp4,video/quicktime'
]);
$video = new Video();
$user = \Auth::user();
$video -> user_id = $user->id;
$video -> title = $request -> input('title');
$video -> description = $request -> input('description');
$video -> palabras = $request -> input('palabras');
$video_file = $request -> file('video');
if($video_file){
$video_path = 'original'.'_'.$video_file ->
getClientOriginalName();
Storage::disk('videos')-> put($video_path,
\File::get($video_file));
$videoUrl = storage_path('app/videos/').$video_path;
$storageUrl = storage_path('app/thumbs/');
$fileName = 'thumb'.'_'.time().'.jpg';
$second = 2;
VideoThumbnail::createThumbnail($videoUrl, $storageUrl,
$fileName, $second, $width = 640, $height = 480);
$video -> preview = $fileName;
$video -> video_path = $video_path;
}
$video -> save();
ConvertVideoForPreview::dispatch($video);
return redirect() -> route('home')
-> with (array(
'message' => 'El video se ha enviado con exito'));
}
public function getImage($filename){
$file = Storage::disk('thumbs') -> get($filename);
return new Response($file, 200);
}
public function getVideo($filename){
$file = Storage::disk('converted_videos') ->
get($filename);
return new Response($file, 200);
}
}This is my ConvertVideo Job :
<?php
namespace App\Jobs;
use App\Video;
use Carbon\Carbon;
use FFMpeg;
use FFMpeg\Format\Video\X264;
use Illuminate\Http\Request;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class ConvertVideoForPreview implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable,
SerializesModels;
public $video;
public function __construct(Video $video)
{
$this -> video = $video;
}
public function handle()
{
$converted_name= 'preview'.'-'.$this -> video ->
video_path.'.mp4';
FFMpeg::open('videos/'.$this -> video -> video_path)
-> export()
-> inFormat(new \FFMpeg\Format\Video\X264)
-> save('converted_videos/'.$converted_name);
$this -> video -> update([
'video_preview' => $converted_name,
'processed' => true
]);
}
}One of my goals is to upload large video files (<=4GB), show a uploading process bar and a encoding process bar during the video upload.
I getting this error :
[core:error] [pid 14787:tid 139975366489856] [client
201.188.26.12:51022] Script timed out before returning headers:
index.php,It’s happend when the video es proccesing and the redirect to home dashboard it’s call...
The FFMPEG works :
[2019-07-19 17:20:41] local.INFO: ffprobe executed command successfully
[2019-07-19 17:21:52] local.INFO: ffmpeg executed command successfully
[2019-07-19 17:21:52] local.INFO: ffmpeg running command '/usr/local/bin/ffmpeg' '-y' '-i' '/home/tribus/public_html/storage/app/videos/original_Sequence 01.mov' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '2' '-passlogfile' '/tmp/ffmpeg-passes5d31fbe9010e6ldt9s/pass-5d31fbe90152d' '/home/tribus/public_html/storage/app/converted_videos/preview-original_Sequence 01.mov.mp4'I have tried : Change all the memory and file size in PHP.ini, Nginx, Apache... (Probably I’m missing one)...
Changed timeouts too.
My environment : VPS 4GB 50GB, APACHE 2.4, PHP7.3, MySql MariaDB, WebServer : Apache-Nginx, Laravel 5.8.
Can anyone help me to reach this ?...
This is how the large video looks after converted and show 500 error in the browser :
Error video processed -
Have problems using FFMPEG to save RGB image sequence to .mp4
28 septembre 2021, par ClubsI render some images with OpenGL and need to compose them into a video file. Each of the images is a sequence of uint8_t values representing a sRGB color component (image array looks like ...rgbrgbrgb...)



I know very little about video processing and have no experience with ffmpeg libraries at all. I made a little test program using these sources as reference :



https://ffmpeg.org/doxygen/trunk/encode_video_8c-example.html



How to convert RGB from YUV420p for ffmpeg encoder ?



The test program is supposed to make a video about growing green vertical stripe. I'm just trying to figure out how to make a video using some source of raw RGB data.



Here is my code :



#include <iostream>
#include <vector>
#include <algorithm>

extern "C" {
 #include <libavcodec></libavcodec>avcodec.h>
 #include <libavutil></libavutil>opt.h>
 #include <libavutil></libavutil>imgutils.h>
 #include <libswscale></libswscale>swscale.h>
}

static void encode( AVCodecContext* enc_ctx,
 AVFrame* frame, AVPacket* pkt,
 FILE* outfile )
{
 int ret;
 ret = avcodec_send_frame(enc_ctx, frame);
 if (ret < 0) {
 std::cerr << "Error sending a frame for encoding\n";
 return;
 }
 while (ret >= 0) {
 ret = avcodec_receive_packet(enc_ctx, pkt);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 return;
 else if (ret < 0) {
 fprintf(stderr, "Error during encoding\n");
 exit(1);
 }
 fwrite(pkt->data, 1, pkt->size, outfile);
 av_packet_unref(pkt);
 }
}

static constexpr int w = 1920, h = 1080;
static constexpr float fps = 20.f, time = 5.f;
static constexpr int nFrames = static_cast<int>(fps * time);
static std::vector imageRGB(w * h * 3, 0);

static void UpdateImageRGB()
{
 static int d = 50;
 imageRGB.assign(w * h * 3, 0);
 for (int i = 0; i < h; ++i)
 for ( int j = std::max(0, w / 2 - d);
 j < std::min(w, w / 2 + d);
 ++j )
 {
 imageRGB[(w * i + j) * 3 + 0] = 50;
 imageRGB[(w * i + j) * 3 + 1] = 200;
 imageRGB[(w * i + j) * 3 + 2] = 50;
 }
 d += 5;
}

int main()
{
 int ret = 0;
 auto filename = "test.mp4";

 auto codec = avcodec_find_encoder(AV_CODEC_ID_H264);
 if (!codec) {
 std::cerr << "Codec \"x.264\" not found\n";
 return 1;
 }
 auto c = avcodec_alloc_context3(codec);
 if (!c) {
 std::cerr << "Could not allocate video codec context\n";
 return 1;
 }
 auto pkt = av_packet_alloc();
 if (!pkt) return 1;

 // 1.8 bits / (pixel * frame)
 c->bit_rate = static_cast(1.8f * w * h * fps);
 /* resolution must be a multiple of two */
 c->width = w;
 c->height = h;
 /* frames per second */
 c->time_base = AVRational{ 1, static_cast<int>(fps) };
 c->framerate = AVRational{ static_cast<int>(fps), 1 };

 c->gop_size = 10;
 c->max_b_frames = 1;
 c->pix_fmt = AV_PIX_FMT_YUV420P;
 av_opt_set(c->priv_data, "preset", "slow", 0);
 av_opt_set(c->priv_data, "preset", "slow", 0);

 ret = avcodec_open2(c, codec, NULL);
 if (ret < 0) {
 char str[AV_ERROR_MAX_STRING_SIZE];
 std::cerr << "Could not open codec: "
 << av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, ret)
 << "\n";
 return 1;
 }

 FILE * f;
 fopen_s(&f, filename, "wb");
 if (!f) {
 std::cerr << "Could not open " << filename << '\n';
 return 1;
 }

 auto frame = av_frame_alloc();
 if (!frame) {
 std::cerr << "Could not allocate video frame\n";
 return 1;
 }
 frame->format = c->pix_fmt;
 frame->width = c->width;
 frame->height = c->height;
 ret = av_frame_get_buffer(frame, 0);
 if (ret < 0) {
 std::cerr << stderr, "Could not allocate the video frame data\n";
 return 1;
 }

 SwsContext* ctx = sws_getContext( w, h, AV_PIX_FMT_RGB24,
 w, h, AV_PIX_FMT_YUV420P,
 0, 0, 0, 0 );

 for (int i = 0; i < nFrames; i++)
 {
 ret = av_frame_make_writable(frame);
 UpdateImageRGB();
 static const uint8_t* rgbData[1] = { &imageRGB[0] };
 static constexpr int rgbLinesize[1] = { 3 * w };
 sws_scale( ctx, rgbData, rgbLinesize, 0, h,
 frame->data, frame->linesize );
 frame->pts = i;
 /* encode the image */
 encode(c, frame, pkt, f);
 }
 encode(c, NULL, pkt, f);

 fclose(f);
 avcodec_free_context(&c);
 av_frame_free(&frame);
 av_packet_free(&pkt);
 return 0;
}
</int></int></int></algorithm></vector></iostream>



The program generates 33.9k video file with further console output :



[libx264 @ 0000020c18681800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000020c18681800] profile High, level 5.0, 4:2:0, 8-bit
[libx264 @ 0000020c18681800] frame I:11 Avg QP: 0.00 size: 639
[libx264 @ 0000020c18681800] frame P:74 Avg QP: 0.32 size: 174
[libx264 @ 0000020c18681800] frame B:15 Avg QP: 2.26 size: 990
[libx264 @ 0000020c18681800] consecutive B-frames: 70.0% 30.0%
[libx264 @ 0000020c18681800] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0000020c18681800] mb P I16..4: 0.6% 0.0% 0.0% P16..4: 2.1% 0.0% 0.0% 0.0% 0.0% skip:97.3%
[libx264 @ 0000020c18681800] mb B I16..4: 0.1% 0.0% 0.0% B16..8: 0.6% 0.0% 0.0% direct: 0.6% skip:98.7% L0:39.8% L1:60.2% BI: 0.0%
[libx264 @ 0000020c18681800] final ratefactor: -46.47
[libx264 @ 0000020c18681800] 8x8 transform intra:0.0%
[libx264 @ 0000020c18681800] direct mvs spatial:0.0% temporal:100.0%
[libx264 @ 0000020c18681800] coded y,uvDC,uvAC intra: 0.0% 0.1% 0.1% inter: 0.0% 0.1% 0.1%
[libx264 @ 0000020c18681800] i16 v,h,dc,p: 99% 0% 1% 0%
[libx264 @ 0000020c18681800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 0% 100% 0% 0% 0% 0% 0% 0%
[libx264 @ 0000020c18681800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 46% 0% 54% 0% 0% 0% 0% 0% 0%
[libx264 @ 0000020c18681800] i8c dc,h,v,p: 96% 1% 3% 0%
[libx264 @ 0000020c18681800] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000020c18681800] ref P L0: 70.2% 0.0% 29.8% 0.0% 0.0%
[libx264 @ 0000020c18681800] kb/s:55.61




- 

- "Media Player Classic" on Windows plays this video but the time slider doesn't move, and the video cannot be fast-forwarded to some frame
- VLC cannot play the video at all. It launches, shows me VLC logo, and time slider (which is unusually big) jumps from left to right, not responding to my clicks
- If I set time = 0.05 to make a video of only 1 frame, I cannot play it even with "Media Player Classic". I want to make an algorithm to convert the arbitrary number of raw RGB images into the video files, even if there's only one image, and with arbitrary image size (that is, width and height may be odd).
- As I said, I don't really understand what am I doing. There are low-level codec settings in lines 83-84. Are they all right ?
- Do I have to manually set a bit rate (line 75) ? Shouldn't it be calculated automatically by the codec ?