
Recherche avancée
Autres articles (35)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (6685)
-
【carrierwave+ffmpeg】can't upload the video with sound
10 avril 2020, par ken akitaI want to make "Fake Instagram" Rails application.
then I made the uploader and I can upload the video(mp4), but no sound.
I can listen to the sound on my desktop but can't on my application, like this image, speakers not working.
enter image description here



Code is here. I guess something wrong with image_uploader.rb or show.html.erb.
Note that first I made the ImageUploader to upload image, then I want to add video posting system to upload video. Both uploading done, but video without sound.
Really thank you for your advise !



*image_uploader.rb
require 'streamio-ffmpeg'

class ImageUploader < CarrierWave::Uploader::Base
 include CarrierWave::MiniMagick
 process resize_to_fit: [230, 183]

 storage :file

 def store_dir
 "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
 end

 version :thumb do
 process resize_to_fit: [230, 183]
 end
 version :screenshot do
 process :screenshot
 def full_filename (for_file = model.logo.file)
 "screenshot.jpg"
 end
 end

 def screenshot
 tmpfile = File.join(File.dirname(current_path), "tmpfile")

 File.rename(current_path, tmpfile)

 movie = FFMPEG::Movie.new(tmpfile)
 movie.screenshot(current_path + ".jpg", {resolution: '230x183' }, preserve_aspect_ratio: :width)
 File.rename(current_path + ".jpg", current_path)

 File.delete(tmpfile)
 end

 def extension_whitelist
 %w(jpg jpeg gif png mp4)
 end
end




*show.html.erb
<h1>Stroll</h1>
<p><%= notice %></p>
<p></p>
<% if @stroll[:image] == nil %>
 <%= image_tag"03summer_ver8-l.jpg", width:"230", height:"183" %>
<% elsif @stroll.image.file.content_type.include?('video/') %>
 <%= link_to @stroll.image_url.to_s do %>
 <%= image_tag(@stroll.image_url(:screenshot).to_s, id: "image", :alt => "screenshot") %>
 <% end %>
<% else %>
 <%= image_tag(@stroll.image.url) if @stroll.image && @stroll.image.url %>
<% end %>
<p>user <%= @stroll.user.name %></p>
<p>『<%= @stroll.title %>』</p>
<p>content: <%= @stroll.content %></p>
<p>tag: <%= @stroll.tag %></p>
<p>comment: </p>
<div>
 <%= render partial: 'comments/index', locals: { comments: @comments, stroll: @stroll } %>
</div>
<% if user_signed_in? && @stroll.user_id != current_user.id %>
 <%= render partial: 'comments/form', locals: { comment: @comment, stroll: @stroll } %>
<% end %>
<% if current_user %>
 <% unless @stroll.user_id == current_user.id %>
 <% if @favorite.present? %>
 <%= link_to 'cancel', favorite_path(id: @favorite.id), method: :delete, class: 'btn btn-info' %>
 <% else %>
 <%= link_to 'Like!', favorites_path(stroll_id: @stroll.id), method: :post, class: 'btn btn-warning' %>
 <% end %>
 <% end %>
<% end %>
&emsp;
<%= link_to "Index", strolls_path %>



-
opening jpg image after saving from ffmpeg not working
30 mai 2013, par user2042152In my project I am saving videos, converting formats to .swf using ffmpeg. Converting and saving the videos is working fine, but I have a problem with creating the thumbnails. It saves a "picture.jpg" but there is no image. looking at the thumbnail its only got the normal photoviewer sign which is fine, but when I try to open the image it gives a message of
Windows photo viewer : Windows photo viewer cant open this picture because the file appears to be damaged, corrupted, or is too large. (this image is 2.7MB) - Photos taken from my camera is about 5MB and that opens.PictureViewer : couldn't display "image.jpg" because a suitable graphics importer could not be found.
Paint : Paint cannot read this file. This is not a valid bitmap file or its format is currently not supported.
The images won't open in any I done to save the image :protected void btnUploadVideo_Click(object sender, EventArgs e)
{
string dtMonth = DateTime.Now.ToString("MMM");
string dtYear = DateTime.Now.ToString("yyyy");
lblMsg.Visible = false;
lblMsg.Visible = true;
// Before attempting to save the file, verify
// that the FileUpload control contains a file.
if (fuPath.HasFile)
{
// Get the size in bytes of the file to upload.
int fileSize = fuPath.PostedFile.ContentLength;
// Allow only files less than 2,100,000 bytes (approximately 2 MB) to be uploaded.
if (fileSize < 10497717)
{
// Call a helper method routine to save the file.
SaveFile2();
}
}
else
// Notify the user that a file was not uploaded.
lblMsg.Text = "You did not specify a file to upload.";
}
private void SaveFile2()
{
string dtMonth = DateTime.Now.ToString("MMM");
string dtYear = DateTime.Now.ToString("yyyy");
if (fuPath != null || fuPath.PostedFile != null)
{
postedfilename = fuPath.PostedFile.FileName;
SavePath = Server.MapPath("~\\Video\\");
string NewFName = postedfilename;
NewFName = NewFName.Substring(NewFName.LastIndexOf("\\") + 1, NewFName.Length - NewFName.LastIndexOf(".")) + "." + NewFName.Substring(NewFName.LastIndexOf(".") + 1);
Filenamewithpath = SavePath + NewFName;
string outputPath = Server.MapPath("~\\uploads\\" + dtYear + "\\" + dtMonth + "\\SWF\\");
CreateDirectoryIfNotExists(SavePath);
CreateDirectoryIfNotExists(outputPath);
//Save The file
fuPath.PostedFile.SaveAs(Filenamewithpath);
//Start Converting
string inputfile, outputfile, filargs;
string withoutext;
//Get the file name without Extension
withoutext = Path.GetFileNameWithoutExtension(Filenamewithpath);
//Input file path of uploaded image
inputfile = SavePath + NewFName;
//output file format in swf
outputfile = outputPath + withoutext + ".swf";
Session["outputfile"] = withoutext + ".swf";
//file orguments for FFMEPG
// Create the path and file name to check for duplicates.
string pathToCheck = outputfile;
// Create a temporary file name to use for checking duplicates.
string tempfileName = "";
// Check to see if a file already exists with the
// same name as the file to upload.
if (System.IO.File.Exists(pathToCheck))
{
int counter = 2;
while (System.IO.File.Exists(pathToCheck))
{
// if a file with this name already exists,
// prefix the filename with a number.
tempfileName = outputPath + counter.ToString() + withoutext + ".swf";
pathToCheck = tempfileName;
counter++;
}
outputfile = tempfileName;
// Notify the user that the file name was changed.
lblMsg.Text = "A file with the same name already exists." +
"<br />Your file was saved as " + counter.ToString() + withoutext + ".swf";
}
filargs = "-i " + inputfile + " -ar 22050 " + outputfile;
string spath;
spath = Server.MapPath(".");
Process proc;
proc = new Process();
proc.StartInfo.FileName = spath + "\\ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = filargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = false;
try
{
proc.Start();
fuPath.PostedFile.SaveAs(outputfile);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
proc.WaitForExit();
proc.Close();
//Create Thumbs
string thumbPath, thumbName;
string thumbargs;
thumbPath = Server.MapPath("~\\uploads\\" + dtYear + "\\" + dtMonth + "\\Thumb\\");
CreateDirectoryIfNotExists(thumbPath);
thumbName = thumbPath + withoutext + ".jpg";
// Create the path and file name to check for duplicates.
string thumbPathToCheck = thumbName;
// Create a temporary file name to use for checking duplicates.
string thumbTempfileName = "";
// Check to see if a file already exists with the
// same name as the file to upload.
if (System.IO.File.Exists(thumbPathToCheck))
{
int counter = 2;
while (System.IO.File.Exists(thumbPathToCheck))
{
// if a file with this name already exists,
// prefix the filename with a number.
thumbTempfileName = thumbPath + counter.ToString() + withoutext + ".jpg";
thumbPathToCheck = thumbTempfileName;
counter++;
}
thumbName = thumbTempfileName;
// Notify the user that the file name was changed.
lblMsg.Text = "A file with the same name already exists." +
"<br />Your file was saved as " + counter.ToString() + withoutext + ".jpg";
}
//thumbargs = "-i " + inputfile + " -an -ss 00:00:03 -s 120×90 -vframes 1 -f mjpeg " + thumbName;
// thumbargs = "-i " + inputfile + "-f image2 -ss 1.000 -vframes 1 " + thumbName;
thumbargs = "-i " + inputfile + " -vframes 1 -ss 00:00:10 -s 150x150 " + thumbName;
// thumbargs = "ffmpeg -i" + inputfile + " -ss 0:00:01.000 -sameq -vframes 1 " + withoutext + ".jpg";
// thumbargs = "-i " + inputfile + " -vframes 1 -ss 00:00:07 -s 150x150 " + thumbName;
Process thumbproc = new Process();
thumbproc.StartInfo.FileName = spath + "\\ffmpeg\\ffmpeg.exe";
thumbproc.StartInfo.Arguments = thumbargs;
thumbproc.StartInfo.UseShellExecute = false;
thumbproc.StartInfo.CreateNoWindow = true;
thumbproc.StartInfo.RedirectStandardOutput = false;
string data = "";
try
{
fuPath.PostedFile.SaveAs(thumbName);
thumbproc.Start();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
thumbproc.WaitForExit();
thumbproc.Close();
File.Delete(inputfile);
lblMsg.Text = "Video Uploaded Successfully";
hyp.Visible = true;
hyp.NavigateUrl = "WatchVideo.aspx";
SaveToDB(outputfile, thumbName);
}
}EDIT :
If it is the thumbargs, I have tried a few ways, but with no success ://thumbargs = "-i " + inputfile + " -an -ss 00:00:03 -s 120×90 -vframes 1 -f mjpeg " + thumbName;
// thumbargs = "-i " + inputfile + "-f image2 -ss 1.000 -vframes 1 " + thumbName;
thumbargs = "-i " + inputfile + " -vframes 1 -ss 00:00:10 -s 150x150 " + thumbName;
// thumbargs = "ffmpeg -i" + inputfile + " -ss 0:00:01.000 -sameq -vframes 1 " + withoutext + ".jpg";This is how it looks when saved, but can't open....
EDIT :
I tried adding the argument to the command prompt to see if it works there but it gave me a message of : [NULL @ 000000000025f7a0] Unable to find a suitable output format for 'vframes'
vframes : invalid argument
The line I used :ffmpeg -i VID2012.3GP vframes 1 VID2012.jpg
If it is that it is not set correctly in IIS how do I set it ?
EDIT :
I changed a bit of my code. Debugging through my code there is no exception that is thrown, but if I point the mouse over the process (after it started) it "shows an exception of type System.InvalidOperationException"thumbargs = "-i " + postedfilename + " vframes 1" + thumbName;
ProcessStartInfo thumbProcstartIfo = new ProcessStartInfo();
thumbProcstartIfo.FileName = @"\ffmpeg\ffmpeg.exe";
thumbProcstartIfo.Arguments = thumbargs;
thumbProcstartIfo.UseShellExecute = false;
thumbProcstartIfo.CreateNoWindow = true;
thumbProcstartIfo.RedirectStandardOutput = false;
try
{
using (var process = new Process())
{
process.StartInfo = thumbProcstartIfo;
process.Start();
process.WaitForExit();
}
}
catch (InvalidOperationException ex)
{
lblMsg.Text = ex.ToString();
} -
nginx push rtmp stream to ffmpeg
1er janvier 2021, par vicmortelmansOn my Raspberry Pi with camera module, I try to setup a web-based streaming platform. I want to preview the stream in my browser and use CGI scripts to start/stop broadcasting to youtube (,...).


This is how I did the streaming setup so far :




Nginx puts up an RTMP application
webcam
. This is where I'll send the camera and audio stream usig ffmpeg. It publishes the stream as HLS for the web preview. It's also pushing the stream to another applicationsource
. That's where I want to (occasionally) hook up another ffmpeg process for broadcasting to youtube (,...) RTMP end points.

I initiate the stream using ffmpeg like this :


ffmpeg -loglevel debug -f v4l2 -framerate 15 -video_size 1280x720 -input_format h264 -i /dev/video0 -f alsa -i hw:2 -codec:v copy -g 15 -codec:a aac -b:a 128k -ar 44100 -strict experimental -f flv "rtmp://localhost:1935/webcam/hhart"



So far everything works fine. I can preview the HLS stream using a video.js viewer on my website (also served by nginx).


Now I want to start another ffmpeg process for broadcasting to my youtube channel, hooked up to the
source
application like this :

ffmpeg -loglevel debug -f flv -listen 1 -i rtmp://localhost:1935/source/hhart -c copy 'rtmp://a.rtmp.youtube.com/live2/<key>'
</key>


(in the final setup, launching and killing this process will be done via CGI scripts)


This is what ffmpeg returns :


Opening an input file: rtmp://localhost:1935/source/hhart.
[flv @ 0x2032480] Opening 'rtmp://localhost:1935/source/hhart' for reading
[rtmp @ 0x2032a10] No default whitelist set
[tcp @ 0x20330f0] No default whitelist set



and then... nothing happens. There's no stream coming in at Youtube studio, but there are no error messages either.


Some other tests I did :


- 

-
from the
webcam
application, push directly to the Youtube RTMP => that works ! (but it's not what I want, because I want the HLS stream to be online always, but the broadcasting only when I'm going live.)

-
from VLC display the stream at
rtmp://localhost:1935/source/hhart
=> similar to ffmpeg, there's no error message, the progress bar keeps loading.







So I have the impression that there is something going on, but there's no actual data transmitted.


RTMP section in nginx.conf :


rtmp { 
 server { 
 listen 1935; 
 chunk_size 4000; 
 
 application webcam { 
 live on; 
 hls on; 
 hls_path /Services/Webcam/HLSStream; 
 hls_fragment 3; 
 hls_playlist_length 60; 
 #deny play all; 
 push rtmp://localhost:1935/source/; 
 #push rtmp://a.rtmp.youtube.com/live2/<key>;
 } 
 
 application source { 
 live on; 
 record off; 
 } 
 } 
} 
</key>


Of course, I may be totally on the wrong track, so any suggestions how I can realize my requirements in a better way, are welcome !


-