mov atom

Will McElderry will at mcelderry.com
Thu Sep 7 15:07:42 UTC 2023


Hi James,


I can't provide any other method to recover your files, but some 
comments that may help below.


*Untrunc:*

untrunc is really easy to use if you have a working MP4 from the same 
camera and the necessary tools (*git* and *docker*).

/#do once to build image:/

     git clone https://github.com/ponchio/untrunc.git
     cd untrunc
     docker build -t untrunc .


/#do each time to fix files (uses docker image just built)/

     #assuming files are in same directory called '/my/dir'

     docker run --rm -v /my/dir:/files -w /files untrunc 
working_file.mp4 broken_file.mp4


*Avoiding issues on new files*:

gst-launch-1.0 *-e*

        -e, --eos-on-shutdown
                Force an EOS event on sources before shutting the 
pipeline down. This is useful to make sure muxers create readable files 
when a muxing pipeline is shut down forcefully via Control-C.


Custom pipelines:  A similar approach can be applied with your own 
pipeline if you catch the signals that trigger application shutdown.


The following element properties on *mp4mux:*

   reserved-max-duration: When set to a value > 0, reserves space for 
index tables at the beginning of the file.
                         flags: readable, writable
                         Unsigned Integer64. Range: 0 - 
18446744073709551615 Default: 18446744073709551615
   reserved-moov-update-period: When used with reserved-max-duration, 
periodically updates the index tables with information muxed so far.
                         flags: readable, writable
                         Unsigned Integer64. Range: 0 - 
18446744073709551615 Default: 18446744073709551615


The 'reserved' options are more reliable than '-e' as there are 
situations where '-e' doesn't catch a termination, but the 
'reserved-moov-update-period' property protects against that.



I've also seen the following element properties on *mp4mux:*

   moov-recovery-file  : File to be used to store data for moov atom 
making movie file recovery possible in case of a crash during muxing. 
Null for disabled. (Experimental)
                        flags: readable, writable
                        String. Default: null


And the pipeline element: *qtmoovrecover*

/(see gst-inspect-1.0 qtmoovrecover for more info!)/

I'm not sure if they are a related pair, but I've not been able to get 
them to work together - so if anyone else can comment that would be very 
interesting.


Hope some of that is useful!


Will.


On 07/09/2023 04:53, James via gstreamer-devel wrote:
> If one aborts recording an mp4 file the mov atom is faulty or missing 
> and the recording wont play.
> When I first started to play with gstreamer I saw and glossed over a 
> simple pipeline to restore the atom. I can't find it again.
> Looking at untrunc the task is complex, and I don't know enough to 
> invent a pipeline. Has anybody seen the tutorial or can think up a 
> solution?
> Thanks
> James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230907/47a8343d/attachment.htm>


More information about the gstreamer-devel mailing list