[FFmpeg-user] MSE Implementation Using ffmpeg

2017-06-09 Thread Jacob Trimble
I am trying to implement the MSE[1] API for a project.  This is a
JavaScript API that is being backed by C++ code.  The basic idea is
to create a buffer that is appended opaque (from JS perspective) data
that should be decoded and rendered in a  element.  I would
like to use ffmpeg (specifically libavformat) to handle demuxing of the
content.  I intend to use other methods to handle decoding frames.

[1]: https://w3c.github.io/media-source/

The end goal being to use ffmpeg to give us a bunch of demuxed frames.
It is fine if these are out of order, we can handle reordering frames.
We need to pass media segments in arbitrary order and turn that into
demuxed frames that define buffered ranges of playable regions.  When
we try to play into a region that is not buffered, we will pause the
video, waiting for more data.

I tried using a custom AVIOContext with a custom read callback to read
data from the appended buffers. This is able to demux frames so long
as the segments appear in order.  If I try to give a segment from the
past, there are errors.  First, the "current segment" doesn't get
updated when adding segments to the index; this has a simple fix.  The
other problem is that we have no way to see the new frames or to even
know if the frames exist.

We could use the AVStream::index_entries to find frames we have already
demuxed and to use seeks to get the frames that we have not received
yet; however, since we don't want to store the original data for long,
seeking will be hard to implement.  This also seems like using internals
and I would prefer a more helpful API.

First, if there is a better way to do this, I would love to hear it.
If not, we would like a way to have ffmpeg demux frames in file order,
rather than in DTS order.  The goal being to just use the MP4 parser
to pull out frames, not to play the resulting frames directly.  I
would suggest adding a flag that would allow av_read_frame to output
frames in the order they appear in the files.  This would probably
disable seeking since there is no way to predict where to seek to.  Or
maybe a different function that would act like av_read_frame which
would return in file order.

I would be happy to implement this (since I will probably need to do
this in a fork anyway).  I am wondering if there is a better way to
do it now and whether a feature like this would be accepted.

Thanks.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Resuming ffmpeg encode after interrupt

2017-06-09 Thread JD



On 06/09/2017 01:25 AM, Moritz Barsnick wrote:

On Thu, Jun 08, 2017 at 21:24:52 -0600, JD wrote:

So, instead of restarting from the very beginning, is there a way to resume
the encode based on the size of the output file?
I  mean that ffmpeg should be able to know the time offset of the very
last frame encoded. Is this true?

Well, for most common codecs, it isn't just about frame for frame.
Codec compression often refers to frames before and after, and there
are calculations going on all along (e.g. for average bitrate) which
would be lost. That said, one *could* probably come up with codec
implementations which can become largely stateless at some point,
needing to remember or recover only a few parameters (HW encoders
*probably* work that way), but I don't know about actual cut-points.
These implementations may or may not exist, but it's just not that
easy. And ffmpeg isn't capable of keeping its encoding state, as far as
I know. (Intra-only codecs may be different, as each frame is encoded
for itself. But you still need to know about metadata, syncing with
audio, and so on. Video only: You can just continue and attach where
you left off.)


I am not an audio video guru. I am just thinking out loud to try to
clarify my question.

What you are trying to do it to suspend and resume a process which
needs to actually *go away* inbetween. There do exist methods for that,
often called "checkpointing" (or "checkpoint/restore"). For Linux, the
tool "criu" comes to mind:

https://criu.org/

The tool is maintained and is actually supposed to work quite well. I
haven't used it in many years though.

Your use case is described here:
https://criu.org/Usage_scenarios#Snapshots_of_apps

I think you need to scan the docs and the Wiki for understanding how to
use it. Please do let us know how it works for you!

Cheers,
Moritz

Thank you Moritz.
I did find and install criu. So, the scenario I would use it is as follows:

1. I want to suspend the system to disk (i.e. to swap space).
2. Before I do that, I stop the encode/decode with Control-Z
3. I run criu -t 
4. I suspend the system to disk

Some hours later,

I power up and boot same kernel I was running.
USUALLY it will automagically see that a full memory image dump is saved 
on the swap device.
It proceeds to decompress it and load it into RAM, and restores the 
CONTEXTS of all CPUS to their

state at time of suspend.
Systems resumes where it left off.
I restore the process
criu restore -d -D  -t 

Now I am not sure that the system will ALWAYS resume from suspend-to-disk.
Sometimes, for reasons totally opaque to me, it decided not to resume, but
do a normal boot. All processes that WERE running at time of system suspend,
are lost, and so are the data they were manipulating.
In such cases, I am not certain the criu will work, because the PID to 
restore
may clash with that of a new process that is running but is a totally 
different

process - such  as a browser, or an email client etc.

Thanx,

JD
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Blue Ray Question

2017-06-09 Thread Ron Barnes
Thank you for the concise answer and quick response!

-Original Message-
From: ffmpeg-user [mailto:ffmpeg-user-boun...@ffmpeg.org] On Behalf Of Carles 
Vila
Sent: Friday, June 9, 2017 9:40 AM
To: FFmpeg user questions 
Subject: Re: [FFmpeg-user] Blue Ray Question

On 9 June 2017 at 15:26, Ron Barnes  wrote:

> Hello All,
>
>
>
> I know there are tools out there for this question but I'm hoping 
> FFmpeg can handle things.
>
> I have an old blue ray that I would like to shrink.  The only problem 
> is when I open the BR in File Explorer there is no way of knowing 
> which files are the main movie and what order those files are supposed to be 
> in.
>
>
>
> Can FFmpeg or a tool of FFmpeg help in determining the answer?
>
>
>
> What is the main movie files and what order should they be in?
>
>
No, ffmpeg won't help you in determining that Blu-rays can be authored in many 
ways. The main content is most probably the largest file. For a feature film, 
around 20 GB for a single-layer BD or
40 GB for a double-layer BD.
Other files you will see are extra content, trailers, logos, whatever. just 
look for the largest file.
Keep in mind if it's a commercial BD, it will be encrypted and ffmpeg won't 
decode it.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with 
subject "unsubscribe".

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] Rtsp to WebRTC

2017-06-09 Thread Yanet Giuse
Hello all,
This is a simple question, 
Is there a way to use ffserver and ffmpeg commands to re-stream a RTSP ip 
camera video to WebRTC (or any VP8 container) as a service , so then I can view 
it in an extern web?Can you provide a simple example or a guide?
Thank you!



___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Blue Ray Question

2017-06-09 Thread Carles Vila
On 9 June 2017 at 15:26, Ron Barnes  wrote:

> Hello All,
>
>
>
> I know there are tools out there for this question but I'm hoping FFmpeg
> can
> handle things.
>
> I have an old blue ray that I would like to shrink.  The only problem is
> when I open the BR in File Explorer there is no way of knowing which files
> are the main movie and what order those files are supposed to be in.
>
>
>
> Can FFmpeg or a tool of FFmpeg help in determining the answer?
>
>
>
> What is the main movie files and what order should they be in?
>
>
No, ffmpeg won't help you in determining that
Blu-rays can be authored in many ways. The main content is most probably
the largest file. For a feature film, around 20 GB for a single-layer BD or
40 GB for a double-layer BD.
Other files you will see are extra content, trailers, logos, whatever. just
look for the largest file.
Keep in mind if it's a commercial BD, it will be encrypted and ffmpeg won't
decode it.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] Blue Ray Question

2017-06-09 Thread Ron Barnes
Hello All,

 

I know there are tools out there for this question but I'm hoping FFmpeg can
handle things.

I have an old blue ray that I would like to shrink.  The only problem is
when I open the BR in File Explorer there is no way of knowing which files
are the main movie and what order those files are supposed to be in.

 

Can FFmpeg or a tool of FFmpeg help in determining the answer?

 

What is the main movie files and what order should they be in?

 

Thanks,

 

-Ron

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Create thumbnails from RTMP stream

2017-06-09 Thread zermok
if the same command works on you local address so the problem comes from your
server, not ffmpeg



--
View this message in context: 
http://www.ffmpeg-archive.org/Create-thumbnails-from-RTMP-stream-tp4675783p4680258.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Create an AAC stream matching the Core Media Audio packet format / priming etc?

2017-06-09 Thread Mark Burton
I appreciate I don't fully grasp the complexities or know the full story here, 
but do you not think its fair to say this should be considered a major ffmpeg 
bug or issue? It seems clear to me, and others, that the current .mov muxer 
produces a file which is incompatible with Quicktime itself. AAC priming in 
this container does not follow as advised and that appears to be the main 
reason its breaks when decoded.

Going back to changing the file manually (after using aresample and asetpts 
filters), I can get a file which decodes perfectly in Quicktime and VLC by just 
changing the single value for duration in the sound edit list to match the 
video track duration:

trak - Track
edts - Edits
elst - Edit List
'segment duration’

This file also imports perfectly into Avid Media Composer, a first. The movie 
header still shows an overlong duration, but that does not appear to affect 
playback. Its really just a hack though.

Surely it would be preferable to have a permanent solution to this which did 
not require the use of multiple audio filters and manual hacks to produce a 
working file with AAC for Quicktime.

Many thanks for your patience with this, I know I’ve been banging on this door 
for a few months, so I apologise for clogging up your inboxes. Its not my 
intention to be accusatory, I’m genuinely trying to help improve the tool as 
best I can. A re-engagement from the experts here would be hugely appreciated 
and I will do all I can to help.

Mark
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".