mp4box | convert flv to mp4
kandi X-RAY | mp4box Summary
kandi X-RAY | mp4box Summary
convert flv to mp4 progressively.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- main2 is the main function .
- NewMp4Media returns a new Mp4Media struct
- Readbox box header .
- Create a new mp4 box header .
- Iterate over STcos
- Open the MP4 media file
- Iterate over box
- foreach child box .
- nextBox body
- Converts the encoded box to a slice .
mp4box Key Features
mp4box Examples and Code Snippets
Community Discussions
Trending Discussions on mp4box
QUESTION
I have a little batch file (see below) that does what the REM statement says.
When executed it displays each filename in turn as it's being processed (with a progress bar (of sorts) as the file is 're-written' to disk) but I would also like it to display a "counter" (starting at 1) that increments with each file processed so that when the final file is processed the counter will then display the total number of files that have been processed.
Is there any simple change I could make to achieve this? (I am not a coder, the batch file was given to me by someone else with whom I have lost contact.)
...ANSWER
Answered 2022-Feb-07 at 08:47To implement a counter is quite easy:
QUESTION
I want to split mp4 files that are greater than 500MB into segments smaller than 500MB.
How do I create a for loop to iterate over a directory of files, running
...ANSWER
Answered 2022-Jan-17 at 12:47You can perhaps use find
, e.g.:
QUESTION
i am exploring MPEG-DASH technique for video adaptation. As a test case, i have two versions of the same video with different resolutions 400x250(1.mp4) & 640x360(2.mp4) and want to stream it via MPEG DASH. Using GPAC - MP4Box i have generated the mpd using below command:
...ANSWER
Answered 2021-Nov-23 at 09:28MPEG DASH is a request and response streaming protocol - the client requests each segment and the streaming server responds with the appropriate segment.
The client decides which bandwidth to request from those available in the manifest, usually based on its view of the network conditions at the time, based on buffering etc, and on the devices capabilities.
Most clients will also allow you manually select a bit rate from those available.
If you want to modify a client to use one bit rate for a given time period and then another bit rate for a different time period, then you will likely want to modify the algorithm in the client that choose the bit rate to request.
Open source players sometimes allow you specify a custom function to do this - some examples:
- exoplayer - more info here: https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9
- Dash.js - more info here: https://stackoverflow.com/a/47225096/334402
If you don't want to change anything on the client and want to make the server dictate the stream that is used, the simplest way would be to only provide one bit rate for the first time period and then only the other bit rate for the next period.
MPEG DASH cann support multiple periods - see the diagram below from a DASH overview paper (link at the time of writing: https://www.nctatechnicalpapers.com/Paper/2012/2012-mpeg-dash-a-technical-deep-dive-and-look-at-what-s-next)
You can see that if you have one period with a single adaption set with a single bit rate or representation, and then the next period also with a single bit rate or representation, you can also achieve what you want. I think it is fair to say, however, that this is not a typical way to use DASH.
QUESTION
This use case is a service that manually encodes a series of uncompressed .wav media segments into .m4s fragments for broadcast via MPEG-DASH, using ffmpeg to compress the .wav to .aac and sannies/mp4parser to assemble the aac audio into a .m4s media fragment.
I created this public GitHub project to reproduce the issue in its entirety.
For example, here's the custom ChunkFragmentM4sBuilder.java class.
The first example using MP4 box works, insofar as I am able to generate an initializing MP4 + series of fragment M4s files which can then be concatenated to form a playable MPEG4 stream.
Note: it's a requirement for this use case that each media segment is encoded from an individually generated source segment, versus using a tool such as MP4Box to stream from a continuous audio source.
Attempts to manually build media segments via mp4parser are still failing overall, because the fragments written by my ChunkFragmentM4sBuilder.java used below are malformed. But I'm having a difficult time understanding how exactly they are malformed.
It's been helpful for me to compare the two test logs side by side, ChunkFragmentM4sBuilderTest.log.txt and MP4BoxTest.log.txt.
via Java mp4parser (malformed)The former log is from ChunkFragmentM4sBuilderTest.java which results in the concatenated test output test-java-mp4parser.mp4 which is in fact empty:
...ANSWER
Answered 2021-Oct-23 at 13:07test-java-mp4parser.mp4
is not empty but is invalid because:
- the
sidx
entry referenced size is wrong - the
tfhd
is overriding the default sample description index (1
) with0
- the
trun
doesn't specify the data offset - the
mdat
AAC data starts with 8 zero bytes which cause the decoding to fail
The file plays with FFmpeg if these are fixed.
The m4s
segments listed are also malformed and don't seem to correspond to the concatenation result. For example the sequence number is used as the sample description index.
QUESTION
I installed GPAC on a mac running OSX 10.13, and then followed a tutorial to install MP4box by doing:
...ANSWER
Answered 2021-Jul-18 at 11:36GPAC maintainer here.
On OS X you need to copy the lib in the lib folder, not the bin one: sudo cp -R /Applications/GPAC.app/Contents/MacOS/lib/* /usr/local/lib
By the way I urge you to follow the official doc.
QUESTION
Essentially, I wish to concatenate a series of videos using MP4Box. When I attempt to do so, I receive the following error:
...ANSWER
Answered 2021-Apr-28 at 19:46File attributes must match, but they are different. See a list of attributes that must match for proper concatenation.
Important incongruities:
- H.264 profiles (High vs Constrained Baseline)
- Timebase (16384 tbn vs 30k tbn)
- And one is has audio while the other does not
This method is good if you need to add a short segment to a long video. It will leave the long video untouched and therefore will preserve the quality and it will be fast. Downside is that you have to make sure all of the attributes match which can be difficult if you are unfamiliar with this topic.
Example to make static.mp4
like 0.mp4
, using anullsrc filter to generate blank/silent/dummy/filler audio.
Re-encode:
QUESTION
I'm using auto-editor first to cut out motionless parts, then Mp4Box to add my intro.
I can't figure out how to automatically use the output from auto-editor into Mp4Box.
This is what I have so far.
...ANSWER
Answered 2021-Feb-11 at 12:59You have to create the variable $a
on a separate statement, before calling any of the commands that uses it.
QUESTION
I'm using MediaSource
extension to play videos. However,MediaSource
only supports fragmented MP4 videos.
How can I convert a non-fragmented MP4 video into a fragmented MP4 video in JavaScript so that I can use MediaSource
to play the video?
MP4Box's isFragmented
boolean returns false
on non-fragmented videos:
ANSWER
Answered 2021-Jan-14 at 22:42You could use ffmpeg.wasm
, it's basically ffmpeg for the browser but with native performance. This way you could integrate the fragmentation into your front end which is what you are trying to do, if I understand correctly.
I am afraid I can't help you with the actual fragmentation part using ffmpeg, but this post discusses it for normal ffmpeg.
QUESTION
I want to find a npm package, or a tool for getting information such as mp4 video frame rate on the front end. Then introduce the npm package into the vue project. This tool should look like this. It gets the address of the video, and outputs information such as the frame rate of the video (this information must be present). The more other information, the better. I have found a map4box.js, "https://github.com/gpac/mp4box.js/". But I can't find the frame rate information I want on his official website. So I want to ask if anyone knows about this tool. It would be better if there is a demo code.thank you all.
...ANSWER
Answered 2021-Jan-13 at 14:34I would try doing it myself like shown in this Stackoverflow article. In my opinion an npm package would be overkill.
QUESTION
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using WMPLib;
namespace Mp4BoxSplitter {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
}
private void BOpen_Click(object sender, EventArgs e) {
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
tFileName.Text = openFileDialog1.FileName;
this.axWindowsMediaPlayer1.URL = tFileName.Text;
}
}
private void BStartTime_Click(object sender, EventArgs e) {
tStartTime.Text = axWindowsMediaPlayer1.Ctlcontrols.currentPosition.ToString("0.##");
}
private void BEndTime_Click(object sender, EventArgs e) {
tEndTime.Text = axWindowsMediaPlayer1.Ctlcontrols.currentPosition.ToString("0.##");
}
private void BCutSave_Click(object sender2, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.stop();
//pokličem mp4box.exe s parametri
Process p = new Process();
p.StartInfo.FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "mp4box", @ "mp4box.exe");
string sStartTime = decimal.Parse(tStartTime.Text).ToString("0.##").Replace(",", ".");
string sEndTime = decimal.Parse(tEndTime.Text).ToString("0.##").Replace(",", ".");
string inFileName = tFileName.Text;
string outFileName = inFileName.Substring(0, inFileName.LastIndexOf(".")) + "_" + sStartTime + "-" + sEndTime + inFileName.Substring(inFileName.LastIndexOf("."));
string @params = "-splitx " + sStartTime + ":" + sEndTime + " " + inFileName + " -out " + outFileName;
Debug.WriteLine(p.StartInfo.FileName + " " + @params);
p.StartInfo.Arguments = @params;
var sb = new StringBuilder();
sb.AppendLine("mp4box.exe results:");
// redirect the output
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
// hookup the eventhandlers to capture the data that is received
p.OutputDataReceived += (sender, args) => {
if (args.Data != null && !args.Data.StartsWith("Splitting:") && !args.Data.StartsWith("ISO File Writing:")) {
sb.AppendLine(args.Data);
}
};
p.ErrorDataReceived += (sender, args) => {
if (args.Data != null && !args.Data.StartsWith("Splitting:") && !args.Data.StartsWith("ISO File Writing:")) {
sb.AppendLine(args.Data);
}
};
// direct start
p.StartInfo.UseShellExecute = false;
p.Start();
// start our event pumps
p.BeginOutputReadLine();
p.BeginErrorReadLine();
// until we are done
p.WaitForExit();
tResult.Text = sb.ToString();
}
private void TFileName_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Enter) {
this.axWindowsMediaPlayer1.URL = tFileName.Text;
}
}
private void TFileName_DragEnter(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
e.Effect = DragDropEffects.Copy;
} else {
e.Effect = DragDropEffects.None;
}
}
private void TFileName_DragDrop(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
tFileName.Text = files[0];
this.axWindowsMediaPlayer1.URL = tFileName.Text;
}
}
private void BMinus1Sec_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition -= 1;
axWindowsMediaPlayer1.Refresh();
}
private void BMinus5Sec_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition -= 5;
axWindowsMediaPlayer1.Refresh();
}
private void BMinus10s_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition -= 10;
axWindowsMediaPlayer1.Refresh();
}
private void BToStart_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 0;
axWindowsMediaPlayer1.Refresh();
}
private void BPlus1Sec_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 1;
axWindowsMediaPlayer1.Refresh();
}
private void BPlus5Sec_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 5;
axWindowsMediaPlayer1.Refresh();
}
private void BPlus10Sec_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 10;
axWindowsMediaPlayer1.Refresh();
}
private void BToEnd_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = axWindowsMediaPlayer1.currentMedia.duration;
axWindowsMediaPlayer1.Refresh();
}
private void BMinusDot5_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition -= 0.5;
axWindowsMediaPlayer1.Refresh();
}
private void BMinusDot2_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition -= 0.2;
axWindowsMediaPlayer1.Refresh();
}
private void BPlusDot5_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 0.5;
axWindowsMediaPlayer1.Refresh();
}
private void BPlusDot2_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 0.2;
axWindowsMediaPlayer1.Refresh();
}
private void BPlusFrame_Click(object sender, EventArgs e) {
((IWMPControls2) axWindowsMediaPlayer1.Ctlcontrols).step(1);
axWindowsMediaPlayer1.Refresh();
}
private void Button1_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.pause();
}
private void BPlayPart_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = double.Parse(tStartTime.Text);
double dInterval = (double.Parse(tEndTime.Text) - double.Parse(tStartTime.Text)) * 1000;
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = dInterval;
axWindowsMediaPlayer1.Ctlcontrols.play();
aTimer.Enabled = true;
}
private void OnTimedEvent(object sender, ElapsedEventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.pause();
var timer = (System.Timers.Timer) sender;
timer.Dispose();
}
private void BExplore_Click(object sender, EventArgs e) {
string sFolderPath = Path.GetDirectoryName(tFileName.Text);
ProcessStartInfo startInfo = new ProcessStartInfo {
Arguments = sFolderPath,
FileName = "explorer.exe"
};
Process.Start(startInfo);
}
}
}
...ANSWER
Answered 2021-Jan-10 at 08:45Perhaps your tFileName.Text;
has spaces in it and you've ended up making a command line like mp4box.exe -splitx 1:2 C:\program files\some\file.ext -out blah.mp4
and mp4box thinks that your two input files are c:\program
and files\some\file.ext
.
To fix issues with running another command from C# the process is typically:
- Use the debugger to find out exactly what arguments string has been built - put a breakpoint on the
var sb = new StringBuilder();
and look at the value of thep.StartInfo.Arguments
in the Locals or Autos panel - Copy that string (right click and choose Copy Value)
- Run it yourself directly in a command prompt (paste it in after the path to the mp4box.exe)
- Fix any issues (e.g. add
"
around any paths with spaces) so that mp4box runs successfully in the command prompt, and then transport the fixes you made on the command line into the code, for example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mp4box
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page