
Recherche avancée
Médias (91)
-
Valkaama DVD Cover Outside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Valkaama DVD Cover Inside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (63)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)
Sur d’autres sites (10459)
-
Server Move For multimedia.cx
1er août 2014, par Multimedia Mike — GeneralI made a big change to multimedia.cx last week : I moved hosting from a shared web hosting plan that I had been using for 10 years to a dedicated virtual private server (VPS). In short, I now have no one to blame but myself for any server problems I experience from here on out.
The tipping point occurred a few months ago when my game music search engine kept breaking regardless of what technology I was using. First, I had an admittedly odd C-based CGI solution which broke due to mysterious binary compatibility issues, the sort that are bound to occur when trying to make a Linux binary run on heterogeneous distributions. The second solution was an SQLite-based solution. Like the first solution, this worked great until it didn’t work anymore. Something else mysteriously broke vis-à-vis PHP and SQLite on my server. I started investigating a MySQL-based full text search solution but couldn’t make it work, and decided that I shouldn’t have to either.
Ironically, just before I finished this entire move operation, I noticed that my SQLite-based FTS solution was working again on the old shared host. I’m not sure when that problem went away. No matter, I had already thrown the switch.
How Hard Could It Be ?
We all have thresholds for the type of chores we’re willing to put up with and which we’d rather pay someone else to perform. For the past 10 years, I felt that administering a website’s underlying software is something that I would rather pay someone else to worry about. To be fair, 10 years ago, I don’t think VPSs were a thing, or at least a viable thing in the consumer space, and I wouldn’t have been competent enough to properly administer one. Though I would have been a full-time Linux user for 5 years at that point, I was still the type to build all of my own packages from source (I may have still been running Linux From Scratch 10 years ago) which might not be the most tractable solution for server stability.These days, VPSs are a much more affordable option (easily competitive with shared web hosting). I also realized I know exactly how to install and configure all the software that runs the main components of the various multimedia.cx sites, having done it on local setups just to ensure that my automated backups would actually be useful in the event of catastrophe.
All I needed was the will to do it.
The Switchover Process
Here’s the rough plan :- Investigate options for both VPS providers and mail hosts– I might be willing to run a web server but NOT a mail server
- Start plotting several months in advance of my yearly shared hosting renewal date
- Screw around for several months, playing video games and generally finding reasons to put off the move
- Panic when realizing there are only a few days left before the yearly renewal comes due
So that’s the planning phase. BTW, I chose Digital Ocean for VPS and Zoho for email hosting. Here’s the execution phase I did last week :
- Register with Digital Ocean and set up DNS entries to point to the old shared host for the time being
- Once the D-O DNS servers respond correctly using a manual ‘dig’ command, use their servers as the authoritative ones for multimedia.cx
- Create a new Droplet (D-O VPS), install all the right software, move the databases, upload the files ; and exhaustively document each step, gotcha, and pitfall ; treat a VPS as necessarily disposable and have an eye towards iterating the process with a new VPS
- Use /etc/hosts on a local machine to point DNS to the new server and verify that each site is working correctly
- After everything looks all right, update the DNS records to point to the new server
Finally, flip the switch on the MX record by pointing it to the new email provider.
Improvements and Problems
Hosting on Digital Ocean is quite amazing so far. Maybe it’s the SSDs. Whatever it is, all the sites are performing far better than on the old shared web host. People who edit the MultimediaWiki report that changes get saved in less than the 10 or so seconds required on the old server.Again, all problems are now my problems. A sore spot with the shared web host was general poor performance. The hosting company would sometimes complain that my sites were using too much CPU. I would have loved to try to optimize things. However, the cPanel interface found on many shared hosts don’t give you a great deal of data for debugging performance problems. However, same sites, same software, same load on the VPS is considerably more performant.
Problem : I’ve already had the MySQL database die due to a spike in usage. I had to manually restart it. I was considering a cron-based solution to check if the server is running and restart it if not. In response to my analysis that my databases are mostly read and not often modified, so db crashes shouldn’t be too disastrous, a friend helpfully reminded me that, “You would not make a good sysadmin with attitudes like ‘an occasional crash is okay’.”
To this end, I am planning to migrate the database server to a separate VPS. This is a strategy that even Digital Ocean recommends. I’m hoping that the MySQL server isn’t subject to such memory spikes, but I’ll continue to monitor it after I set it up.
Overall, the server continues to get modest amounts of traffic. I predict it will remain that way unless Dark Shikari resurrects the x264dev blog. The biggest spike that multimedia.cx ever saw was when Steve Jobs linked to this WebM post.
Dropped Sites
There are a bunch of subdomains I dropped because I hadn’t done anything with them for years and I doubt anyone will notice they’re gone. One notable section that I decided to drop is the samples.mplayerhq.hu archive. It will live on, but it will be hosted by samples.ffmpeg.org, which had a full mirror anyway. The lower-end VPS instances don’t have the 53 GB necessary.Going Forward
Here’s to another 10 years of multimedia.cx, even if multimedia isn’t as exciting as it was 10 years ago (personal opinion ; I’ll have another post on this later). But at least I can get working on some other projects now that this is done. For the past 4 months or so, whenever I think of doing some other project, I always remembered that this server move took priority over everything else. -
'pjsip-apps/Samples' Cannot functionally run vid_streamutil.c sample
2 décembre 2020, par ShootingKIngIssue Description
After building[
Build Varient=Debug
,Build Config=x64
] the latest pjproject-vs14 (retargeted to MSVS 2017, WINSDK=8.1, because my application works at these config) as per the build instruction on trac website. Successfully built pjsua and samples.

I want to use only RTP + FFMPEG APIs (pjmedia) for my application from pjproject.


My config_site.h


#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_FFMPEG 1



FFMPEG (pre build from ffmpeg-N-100121-g052b4c3481-win64-gpl-shared.zip)


But running the example, vid_streamutil.c did not work as expected (? Whats the normal expected behaviour ?).
It says


ffmpeg_vid_cod ffmpeg err -22: Invalid argument
vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)



To Reproduce
Steps to reproduce the behavior :


- 

- run
vid_streamutil.exe
with parameter :--codec=H264 --remote=127.0.0.1:5000 --play-file=test.avi --send-only

(test.avi file being a sample file)




Expected behavior
Get some RTP packets in wireshark while listening to ports 4000 and 5000 maybe ? I dont know whats the expected behaviour, documentation dosent say anything about this :(


Logs/Screenshots
Couldn't catch anything on Wireshark.
Console log of vid_streamutil.exe is


vid_streamutil.exe --codec=H264 --remote=127.0.0.1:5000 --send-only --play-file=test.avi
10:25:24.757 os_core_win32. !pjlib 2.10 for win32 initialized
 
10:25:24.840 wmme_dev.c WMME found 12 devices:
10:25:24.858 wmme_dev.c dev_id 0: Wave mapper (in=2, out=2)
10:25:24.860 wmme_dev.c dev_id 1: Headset Microphone (Arctis 7 Ch (in=2, out=0)
10:25:24.860 wmme_dev.c dev_id 2: Microphone (AMM Virtual Audio D (in=2, out=0)
10:25:24.861 wmme_dev.c dev_id 3: CABLE Output (VB-Audio Virtual (in=2, out=0)
10:25:24.864 wmme_dev.c dev_id 4: VoiceMeeter Output (VB-Audio Vo (in=2, out=0)
10:25:24.864 wmme_dev.c dev_id 5: Microphone (Realtek Audio) (in=2, out=0)
10:25:24.865 wmme_dev.c dev_id 6: Headphones (Arctis 7 Game) (in=0, out=2)
10:25:24.866 wmme_dev.c dev_id 7: Speakers / Headphones (Realtek (in=0, out=2)
10:25:24.867 wmme_dev.c dev_id 8: VoiceMeeter Input (VB-Audio Voi (in=0, out=2)
10:25:24.884 wmme_dev.c dev_id 9: Headset Earphone (Arctis 7 Chat (in=0, out=2)
10:25:24.885 wmme_dev.c dev_id 10: Speakers (AMM Virtual Audio Dev (in=0, out=2)
10:25:24.887 wmme_dev.c dev_id 11: Speakers (VB-Audio Virtual Cabl (in=0, out=2)
10:25:24.887 wmme_dev.c WMME initialized
10:25:24.890 pjlib select() I/O Queue created (0000016B2C5F9608)
10:25:24.892 colorbar_dev.c Colorbar video src initialized with 2 device(s):
10:25:24.915 colorbar_dev.c 0: Colorbar generator
10:25:24.935 colorbar_dev.c 1: Colorbar-active
10:25:24.956 avi_player.c The AVI file has 2 streams.
10:25:24.976 avi_player.c AVI file player 'test.avi' created with 2 media ports
10:25:24.994 vid_streamutil Reading video stream 1280x720 H264 @30.00fps
10:25:25.033 rtp.c pjmedia_rtp_session_init: ses=0000016B2C6793C8, default_pt=97, ssrc=0x294823
10:25:25.053 vstdec0000016B Decoding channel created 720x480 I420<-H264 22/1(~22)fps
10:25:25.054 rtp.c pjmedia_rtp_session_init: ses=0000016B2C62DF1C, default_pt=97, ssrc=0x294823
10:25:25.057 vstenc0000016B Encoding channel created 1280x720 I420->H264 30/1(~30)fps
10:25:25.060 udp0000016B2C6 SO_RCVBUF set to 65536
10:25:25.061 udp0000016B2C6 SO_SNDBUF set to 65536
10:25:25.062 vid_stream.c Video stream vstrm0000016B2C678508 created
10:25:25.086 vstenc0000016B Encoder stream started
10:25:25.104 vstdec0000016B Decoder stream paused
 [VID_STEAMUTIL] Stream is active, dir is send-only, sending to 127.0.0.1:5000
10:25:25.114 vid_streamutil Sending 1280x720 H264 @30.00fps

Commands:
 q Quit

Command: 10:25:25.147 ffmpeg_vid_cod !ffmpeg err -22: Invalid argument
10:25:25.222 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.237 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.250 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.251 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.287 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.311 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.316 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.341 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.353 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.369 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.386 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.387 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.411 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.415 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.452 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.469 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.486 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.496 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.506 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.527 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.547 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.568 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.576 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.604 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.606 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.627 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.648 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.668 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.686 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.711 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.731 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.752 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.769 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.778 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.804 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.827 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.833 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.868 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.886 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.895 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.921 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.923 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.943 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:25.963 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:25.983 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.003 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.019 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.038 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.041 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.060 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.081 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.086 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.109 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.130 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.138 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.162 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.183 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.202 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.220 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.228 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.260 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.281 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.312 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.321 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.321 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.322 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.323 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.323 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.324 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.324 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.333 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.353 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.353 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.381 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.401 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.414 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.429 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.449 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.469 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.480 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.510 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.531 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.553 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.571 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.594 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.615 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.636 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.653 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.671 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.678 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.714 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.736 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.754 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.777 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.781 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
10:25:26.816 ffmpeg_vid_cod ffmpeg err -22: Invalid argument
10:25:26.836 vstenc0000016B Codec encode_begin() error: Codec internal creation error (PJMEDIA_CODEC_EFAILED)
EOF while reading stdin, will quit now..

Commands:
 q Quit

^C



Desktop information :


- 

- OS, Distribution & Version : MS Windows 10 Home, 1909
- PJSIP

- 

- version : 2.10
- applied patch(es) : Nothing Extra
configure
script params : Defaultconfig_site.h
contents : Aforementioned- related third party libraries & versions :
FFMPEG 4.3


















#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 91
#define LIBAVCODEC_VERSION_MICRO 100



Additional context
I didnt change the default program that must except adding some printf's when program goes to exit label, without this it will be very difficult to know which part of the program jumped to exit : label. Anyways, here is the full code,


vid_streamutil.c (with printfs)


Any help is appreciated ^^'
Thanks.


- run
-
How can i save the preview video in pictureBox1 to a avi/mp4 video file on hard disk using directshow ?
10 avril 2016, par benny dayagThe first problem maybe it’s not a problem but for some reason the video preview in the pictureBox1 is working but the frame rate seems not right. I can’t figure how to set/change it. The preview video seems a bit dart to the eyes not flickering but not moving smooth.
The main problem is how to save the preview in the pictureBox1 or directly the streaming to a video file ? The MediaSubtype i’m getting is h.264
The video is from the device legato game capture.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DirectShowLib;
using DirectShowLib.BDA;
using DirectShowLib.DES;
using DirectShowLib.DMO;
using DirectShowLib.Dvd;
using DirectShowLib.MultimediaStreaming;
using DirectShowLib.SBE;
using System.Runtime.InteropServices;
using System.Management;
using System.IO;
using System.Drawing.Imaging;
namespace Youtube_Manager
{
public partial class Elgato_Video_Capture : Form
{
IFileSinkFilter sink;
IFilterGraph2 graph;
ICaptureGraphBuilder2 captureGraph;
System.Drawing.Size videoSize;
string error = "";
List devices = new List();
IMediaControl mediaControl;
public Elgato_Video_Capture()
{
InitializeComponent();
if (comboBox1.Items.Count == 0)
{
for (int xx = 1; xx <= 8; xx++)
{
comboBox1.Items.Add(xx);
}
}
InitDevice();
timer1.Start();
}
IBaseFilter smartTeeFilter;
IPin outPin;
IPin inPin;
private void InitDevice()
{
try
{
//Set the video size to use for capture and recording
videoSize = new Size(827, 505);//1280, 720);
//Initialize filter graph and capture graph
graph = (IFilterGraph2)new FilterGraph();
captureGraph = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
captureGraph.SetFiltergraph(graph);
//Create filter for Elgato
Guid elgatoGuid = new Guid("39F50F4C-99E1-464A-B6F9-D605B4FB5918");
Type comType = Type.GetTypeFromCLSID(elgatoGuid);
IBaseFilter elgatoFilter = (IBaseFilter)Activator.CreateInstance(comType);
graph.AddFilter(elgatoFilter, "Elgato Video Capture Filter");
//Create smart tee filter, add to graph, connect Elgato's video out to smart tee in
smartTeeFilter = (IBaseFilter)new SmartTee();
graph.AddFilter(smartTeeFilter, "Smart Tee");
outPin = GetPin(elgatoFilter, "Video");
inPin = GetPin(smartTeeFilter, "Input");
SetAndGetAllAvailableResolution(outPin);
graph.Connect(outPin, inPin);
//Create video renderer filter, add it to graph, connect smartTee Preview pin to video renderer's input pin
IBaseFilter videoRendererFilter = (IBaseFilter)new VideoRenderer();
graph.AddFilter(videoRendererFilter, "Video Renderer");
outPin = GetPin(smartTeeFilter, "Preview");
inPin = GetPin(videoRendererFilter, "Input");
graph.Connect(outPin, inPin);
// int hr = graph.Connect(outPin, inPin); ;
// DsError.ThrowExceptionForHR(hr);
captureGraph.SetOutputFileName(MediaSubType.Avi, @"e:\screenshots\test1.mp4", out smartTeeFilter, out sink);
//Render stream from video renderer
captureGraph.RenderStream(PinCategory.VideoPort, MediaType.Video, videoRendererFilter, null, null);
//Set the video preview to be the videoFeed panel
IVideoWindow vw = (IVideoWindow)graph;
vw.put_Owner(pictureBox1.Handle);
vw.put_MessageDrain(this.Handle);
vw.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
vw.SetWindowPosition(0, 0, 827, 505);
//Start the preview
mediaControl = graph as IMediaControl;
mediaControl.Run();
}
catch (Exception err)
{
error = err.ToString();
}
}
IPin GetPin(IBaseFilter filter, string pinname)
{
IEnumPins epins;
int hr = filter.EnumPins(out epins);
checkHR(hr, "Can't enumerate pins");
IntPtr fetched = Marshal.AllocCoTaskMem(4);
IPin[] pins = new IPin[1];
while (epins.Next(1, pins, fetched) == 0)
{
PinInfo pinfo;
pins[0].QueryPinInfo(out pinfo);
bool found = (pinfo.name == pinname);
DsUtils.FreePinInfo(pinfo);
if (found)
return pins[0];
}
checkHR(-1, "Pin not found");
return null;
}
public void checkHR(int hr, string msg)
{
if (hr < 0)
{
MessageBox.Show(msg);
DsError.ThrowExceptionForHR(hr);
}
}
public void SetAndGetAllAvailableResolution(IPin VideoOutPin)
{
int hr = 0;
IAMStreamConfig streamConfig = (IAMStreamConfig)VideoOutPin;
AMMediaType searchmedia;
AMMediaType CorectvidFormat = new AMMediaType();
IntPtr ptr;
int piCount, piSize;
hr = streamConfig.GetNumberOfCapabilities(out piCount, out piSize);
ptr = Marshal.AllocCoTaskMem(piSize);
for (int i = 0; i < piCount; i++)
{
hr = streamConfig.GetStreamCaps(i, out searchmedia, ptr);
VideoInfoHeader v = new VideoInfoHeader();
Marshal.PtrToStructure(searchmedia.formatPtr, v);
if (i == 2)// 4
{
CorectvidFormat = searchmedia;
}
}
hr = streamConfig.SetFormat(CorectvidFormat);
IntPtr pmt = IntPtr.Zero;
AMMediaType mediaType = new AMMediaType();
IAMStreamConfig streamConfig1 = (IAMStreamConfig)VideoOutPin;
hr = streamConfig1.GetFormat(out mediaType);
BitmapInfoHeader bmpih = new BitmapInfoHeader();
Marshal.PtrToStructure(mediaType.formatPtr, bmpih);
}
}
}I tried to use this line to save the video to a video file but the video file on hard disk is 0 KB so I guess it’s a wrong way to do it.
I also thought somehow to save each frame(bitmap image) from the pictureBox1 to the hard disk or maybe the memory and use ffmpeg to create/build a video file in real time from each saved frame but I can’t get/save the images(frames) from the pictureBox1 for some reason.I tried using DrawToBitmap but all the frames(bitmaps on hard disk saved) are empty size 2.24 KB
captureGraph.SetOutputFileName(MediaSubType.Avi, @"e:\screenshots\test1.mp4", out smartTeeFilter, out sink);
This is how I tried to get the frames from the pictureBox1
public static int counter = 0;
private void timer1_Tick(object sender, EventArgs e)
{
counter++;
Bitmap bmp = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);
pictureBox1.DrawToBitmap(bmp, pictureBox1.ClientRectangle);
bmp.Save(@"e:\screenshots\" + "screenshot" + counter.ToString("D6") + ".bmp");
bmp.Dispose();
}