Is there a way for MP4 to work in all browsers with VideoJS? - mp4

On the backend of a site I am making for my client, I have an input for my client to put a Dropbox URL to an mp4 file to play on the frontend (he doesn't want to host the files on the server itself).
But, with VideoJS, it looks like I may need a WebM for some browsers and MP4 for others.
Is there a way to make MP4 work with VideoJS in all browsers?
My client doesn't want to have to use 2 or 3 different file types for each video, and wants to just use one mp4 file.
Is this possible?

It is. If the browser can't play MP4 natively (e.g. Firefox), video.js uses a lightweight Flash component to play MP4. This is the default behaviour.

i used ffmpeg to convert the videos for mp4. After converted, the video works on IE, chrome and firefox.
i called a file that execute the following:
define('DS', DIRECTORY_SEPARATOR);
define('SOURCE_PATH', 'put the source path here' . DS);
define('DESTINY_PATH', 'put the destiny path here' .DS);
$cmd = ('ffmpeg -i ' .SOURCE_PATH. name of source file . ' ' .DESTINY_PATH. name of destiny file . '.mp4');
exec($cmd);
define('SOURCE_PATH', 'put the source path here' . DS);
define('DESTINY_PATH', 'put the destiny path here' .DS);
$cmd = ('ffmpeg -i ' .SOURCE_PATH. name of source file . ' ' .DESTINY_PATH. name of destiny file . '.mp4');
exec($cmd);

Related

Flutter FFmpeg moov atom not found whilst running ffmpeg command during recording

Hi am currently trying to retrieve 3 second clips of an audio file whilst it is recording in flutter. I am using the recording module flutter sound and flutter ffmpeg.
I record the audio file with default codec (.aac). The file is saved to the cache getTemporaryDirectory()
I then copy the file using this flutter ffmpeg code
List<String> arguments = ["-ss", start.toString(), "-i", inPath, "-to", end.toString(), "-c", "copy", outPath];
await flutterFFmpeg.executeWithArguments(arguments);
Start: start time (e.g. 0) and End: end time (e.g. 3)
It then returns this error
FFmpeg exited with rc: 1 [mov,mp4,m4a,3gp,3g2,mj2 # 0x748964ea00] moov
atom not found
Helpful information:
A moov atom is data about the file (e.g timescale,duration)
I know the inPath exists because I check that before executing ffmpeg command
The outPath is also format .aac
This ffmpeg function is being ran whilst the recording is still occurring
Example inPath uri looks like this /data/user/0/com.my.app/cache/output.aac
I have no problems when running on iOS, only on android
I would be grateful for help, I have spent many days trying to fix this problem. If you need anymore info please leave a comment. Thanks
Default Codec is not guaranteed to be AAC/ADTS.
It will depend of the Android version of your device.
You can do several things to understand better :
ffprobe on your file to see what has been recorded by Flutter Sound.
Use a specific Codec instead of default : aac/adts is a good choice because it can be streamed (you want to process the audio data during the recording and not after closing the file)
Verify that your file contains something and that the data are not still in internal buffers
Record to a dart PCM stream instead of a file. Working with a file and use FFmpeg to seek into it is complicated and perhaps does not fill your needs.

Get information about file attachment via perl Mechanize

BACKGROUND
I am experimenting with Mechanize on a web forum. The forum has some file attachments in its threads. The attachment can be of various media types. Each attachment has a link to a server-side program called "attachment.php?" and a unique id which identifies the file. When you visit it in a normal browser, a file is returned and the browser decides what to do with it. If it's an image, the file is displayed in the browser window and the titlebar is set to the filename. If it's another type of file, the browser will ask if you want to download the file (and it automatically sets the filename to the name of the file).
QUESTION
My question is how can I explore the details of such file attachments with Mechanize so that I can determine filetype and filename?
I've already successfully downloaded a file using my program, but I have to tell Mechanize what the filename should be. I would prefer to keep the original filename, but to do that I have to be able to discover it somehow. I know it can be done because my browser is able to determine the filetype and filename.
As a secondary objective I would also like to query the size of the file, if this is possible.
I hope my question makes sense and thank you in advance to anyone who takes the time to answer.
To achieve an inspection of the filetype you have to use $mech->res(). It returns an HTTP::Response object, and this class provides the filename method.
Example:
foreach (#media)
{
print "Fetching " . $_->url() . "\n";
$m->get($_);
my $res = $m->res();
if($res->is_success)
{
my $filename = $res->filename();
print "$filename\n";
}
}

MP4Box MP4 concatenation not working

I download lectures in mp4 format from Udacity, but they're often broken down into 2-5 minute chunks. I'd like to combine the videos for each lecture into one continuous stream, which I've had success with on Windows using AnyVideo Converter. I'm trying to do the same thing on Ubuntu 15, and most of my web search results suggest MP4Box, whose documentation and all the online examples I can find offer the following syntax:
MP4Box -cat vid1.mp4 -cat vid2.mp4 -cat vid3.mp4 -new combinedfile.mp4
This creates a new file with working audio, but the video doesn't work. When I open with Ubuntu's native video player, I get the error "No valid frames decoded before end of stream." When I open with VLC, I get the error "Codec not supported: VLC could not decode the format 'avc3' (No description for this codec." I've tried using the -keepsys switch, as well, but I get the same results.
All the documentation and online discussion makes it sound as though what I'm trying to do is and should be really simple, but I can't seem to find info relevant to the specific errors I'm getting. What am I missing?
Use the -force-cat option.
For example,
MP4Box -force-cat -add in1.mp4 -cat in2.mp4 -cat in3.mp4 ... -new out.mp4
From the MP4Box documentation:
-force-cat
skips media configuration check when concatenating file.
It looks, by the presence of 'avc3', that these videos are encoded with h.264|avc. There are several modes for the concatenation of such streams. Either the video streams have compatible encoder configurations (frame size, ...) in which case only one configuration description is used in the file (signaled by 'avc1'). If the configurations are not fully compatible, MP4Box uses the 'inband' storage of those configurations (signaled by 'avc3'). The other way would be to use multiple sample description entries (stream configurations) but that is not well supported by players and not yet possible with MP4Box. There is no other way unless you want to reencode your videos. On Ubuntu, you should be able to play 'avc3' streams with the player that goes with MP4Box: MP4Client.

Create a batch script to automatically unzip music and create directory to put it in

I want to create a script that automatically unzips music albums and creates a new directory for them on Windows 7.
I'd also want the script to compare file metadata to data pulled from a certain music site to ensure the ID3 tags are filled with accurate data.
Would something like Powershell be sufficient? I'd just love a finger pointed in the right direction.
DotNetZip will allow you to do this from PowerShell. It is not a one-liner, but the library will allow you to write the PowerShell script you need.
Tag lib wille allow you to play with ID3Tag. Example :
[Reflection.Assembly]::LoadFrom( (Resolve-Path ".\taglib-sharp.dll") )
$media = [TagLib.File]::Create("C:\Users\Joel\Music\Audity\The Language I Think In-Music of My Heart.ogg")
# Write out the current album name
$media.Tag.Album
# Set the album name to the name of the directory
$media.Tag.Album = ([IO.FileInfo]$media.Name).Directory.Name
# Save the new album name into the file
$media.Save()
You could download 7zip for your unzipping purposes.
The following command can be used to unzip the album:
7z.exe x -oOutputDir AlbumArchive(.zip, .rar, .7z, etc)
I'm not too familiar with the ID3 checkers and whatnot, so I'll defer to another for that part of your question.

How do you trim the XMP XML contained within a jpg

Through the use of sanselan I've found that the root cause of iPhone photos imported to windows becoming uneditable is that there is content (white space?) after the actual XML (for more details and a linked example of the bad XMP XML see https://apple.stackexchange.com/questions/45326/why-can-i-not-edit-some-photos-imported-from-an-iphone-to-windows-vista).
I'd like to scan through my photo archive and 'trim' the XMP XML.
Is there an easy way to do this?
I have some java code that can recursively navigate my photo archive and DETECT the issue. I'm not sure how to trim and write the XML back though.
Obtain the existing XML using any means.
The following works if using the Apache Sanselan library:
String xmpXml = Sanselan.getXmpXml(new File('/path/to/jpeg'));
Then trim it...
xmpXml = xmpXml.trim();
Then write it back to the file using the solution to serializing Xmp XML to an existing jpeg.
try the following steps:
collect all of the photos in a single folder (e.g. folder xmlToConvert on your Desktop)
open a Terminal.app window
cd to the directory you put the files in (e.g. cd ~/Desktop/xmlToConvert)
run the following command from your command line prompt
mkdir converted ; for f in *.xml ; do cat $f | head -n $(wc -l $f) > converted/$f ; done
the converted/ sub-directory should now contain all the files without the whitespace at the end.
(i.e. a folder called converted in the xmlToConvert you created on your Desktop)
hth