[FFmpeg-user] Copying a matroska container including the attachement

2020-12-14 Thread Mathieu Malaterre
Hi there,

What would(should?) be the right command to copy an mkv file
(including the attachment). I tried a naive:

ffmpeg -i input.mkv -map 0 -map_metadata 0 -c copy output.mkv

The attachment information gets lost (the jpg seems to be still there though).

Thanks,
-- 
Mathieu
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] metadata: 'date' behavior in avi/mp4 vs mkv containers

2020-12-03 Thread Mathieu Malaterre
On Wed, Dec 2, 2020 at 9:26 AM Mathieu Malaterre
 wrote:
>
> Hi there,
>
> I am trying to find the documentation for a specific metadata tag:
> 'date'. According to the following page:
>
> * https://wiki.multimedia.cx/index.php/FFmpeg_Metadata

Here is a small reproducer. Let's consider the following reference:

* https://www.matroska.org/technical/tagging.html#temporal-information

In particular the line:

"DATE_RECORDED UTF-8 The time that the recording began. This is akin
to the TDRC tag in ID3."

Steps:

$ wget http://samples.mplayerhq.hu/A-codecs/lossless/luckynight.flac
$ ffmpeg -i luckynight.flac test1.mp3
$ ffmpeg -i test1.mp3 test2.mkv

Gives:

$ exiftool -v3  -l test1.mp3| grep -1 TDRC
  | RecordingTime = 1995
  | - Tag 'TDRC' (6 bytes):
  | 0101: 03 31 39 39 35 00   [.1995.]

While:

$ exiftool -v3  -l test2.mkv| grep -3 1995
  | | | | TagName = DATE
  | | | | - Tag 0x05a3 (4 bytes):
  | | | | 1292: 44 41 54 45 [DATE]
  | | | | TagString = 1995
  | | | | - Tag 0x0487 (4 bytes):
  | | | | 1299: 31 39 39 35 [1995]
  | | | + [SimpleTag directory, 21 bytes]
  | | | | TagName = GENRE
  | | | | - Tag 0x05a3 (5 bytes):

So in summary ID3:TDRC is being copied to Matroska:SimpleTag:DATE,
however the specification seems to indicate that in this case
'DATE_RECORDED' should be prefered.

> ffmpeg has a built-in mechanism for tag: 'title'. I also see that my
> ffmpeg version has the same  property for tag 'date' but only for a
> round trip mp4 ⇔ avi. This property does not work with an mkv
> container.
>
> Is this pure luck that tag 'date' is transferred from avi to mp4 & mp4
> to avi ? Should it work the same way for mkv container ?
>
> Thanks for clarification,
>
> For reference:
>
> ./ffmpeg -version
> ffmpeg version N-100064-g3c92268 Copyright (c) 2000-2020 the FFmpeg developers
> built with gcc 8 (Debian 8.3.0-6)
> configuration: --prefix=/home/mathieu/ffmpeg_build
> --pkg-config-flags=--static
> --extra-cflags=-I/home/mathieu/ffmpeg_build/include
> --extra-ldflags=-L/home/mathieu/ffmpeg_build/lib
> --extra-libs='-lpthread -lm' --bindir=/home/mathieu/bin --enable-gpl
> --enable-gnutls --disable-libaom --enable-libass --enable-libfdk-aac
> --enable-libfreetype --enable-libmp3lame --enable-libopus
> --disable-libsvtav1 --enable-libvorbis --enable-libvpx
> --enable-libx264 --enable-libx265 --enable-nonfree
> libavutil  56. 61.100 / 56. 61.100
> libavcodec 58.113.100 / 58.113.100
> libavformat58. 64.100 / 58. 64.100
> libavdevice58. 11.103 / 58. 11.103
> libavfilter 7. 91.100 /  7. 91.100
> libswscale  5.  8.100 /  5.  8.100
> libswresample   3.  8.100 /  3.  8.100
> libpostproc55.  8.100 / 55.  8.100

The above steps where run using:

$ ffmpeg -version
ffmpeg version N-100132-g53b4550bdd Copyright (c) 2000-2020 the FFmpeg
developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/home/mathieu/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/mathieu/ffmpeg_build/include
--extra-ldflags=-L/home/mathieu/ffmpeg_build/lib
--extra-libs='-lpthread -lm' --bindir=/home/mathieu/bin --enable-gpl
--enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--disable-libsvtav1 --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-nonfree
libavutil  56. 61.100 / 56. 61.100
libavcodec 58.114.100 / 58.114.100
libavformat58. 64.100 / 58. 64.100
libavdevice58. 11.103 / 58. 11.103
libavfilter 7. 91.100 /  7. 91.100
libswscale  5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100
libpostproc55.  8.100 / 55.  8.100


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

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

Re: [FFmpeg-user] MKV To MP4

2020-12-03 Thread Mathieu Malaterre
John,

On Thu, Dec 3, 2020 at 9:51 AM John Henderson via ffmpeg-user
 wrote:
>
> Hi there,
>
> I am not sure whether this is a windows media player issue or FFMPEG. I am
> using ffmpeg to capture the screen and record audio, whilst playing games.
> It does a great job and I save the file as an mkv. I can convert the file
> to mp4 and all seems fine. However when I try to play the file  with
> windows media player version 12.019 etc. I get "network is too busy to play
> file at original quality" and it just sits there doing nothing. If i open
> windows media player classic, it plays the mp4 file perfectly with no
> problems at all. This is the ffmpeg command I used to convert the mkv file
> to mp4
>
> ffmpeg -i laptop.mkv -c copy laptop.mp4

I would at least give it another try using:

-movflags +faststart

* https://trac.ffmpeg.org/wiki/Encode/H.264#AdditionalInformationTips
=> faststart for web video


> Is it possible that it may be the command I used to create the MKV file
> shown below.
>
> "/k ffmpeg.exe -y -probesize 10M -rtbufsize 1500M -f dshow -i audio=""" &
> Audio_name & """ -acodec pcm_s16le -f gdigrab -framerate 60 -i desktop
> -vcodec libx264 -qp 0 -threads 0 -crf 18 -preset ultrafast -tune
> zerolatency " myFile.mkv"
>
> Or is it windows media player 12.0 ??
>
> Any help with this will be really appreciated. Thanks
>
> All the best,
>
> John
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

2cts

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

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

[FFmpeg-user] metadata: 'date' behavior in avi/mp4 vs mkv containers

2020-12-02 Thread Mathieu Malaterre
Hi there,

I am trying to find the documentation for a specific metadata tag:
'date'. According to the following page:

* https://wiki.multimedia.cx/index.php/FFmpeg_Metadata

ffmpeg has a built-in mechanism for tag: 'title'. I also see that my
ffmpeg version has the same  property for tag 'date' but only for a
round trip mp4 ⇔ avi. This property does not work with an mkv
container.

Is this pure luck that tag 'date' is transferred from avi to mp4 & mp4
to avi ? Should it work the same way for mkv container ?

Thanks for clarification,

For reference:

./ffmpeg -version
ffmpeg version N-100064-g3c92268 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/home/mathieu/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/mathieu/ffmpeg_build/include
--extra-ldflags=-L/home/mathieu/ffmpeg_build/lib
--extra-libs='-lpthread -lm' --bindir=/home/mathieu/bin --enable-gpl
--enable-gnutls --disable-libaom --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--disable-libsvtav1 --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-nonfree
libavutil  56. 61.100 / 56. 61.100
libavcodec 58.113.100 / 58.113.100
libavformat58. 64.100 / 58. 64.100
libavdevice58. 11.103 / 58. 11.103
libavfilter 7. 91.100 /  7. 91.100
libswscale  5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100
libpostproc55.  8.100 / 55.  8.100


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

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

Re: [FFmpeg-user] 2nd pass has more frames than 1st pass (99021)2kbits/s dup=27 drop=0 speed=4.76x

2020-12-02 Thread Mathieu Malaterre
On Tue, Dec 1, 2020 at 12:42 AM Carl Eugen Hoyos  wrote:
>
> Am Mo., 30. Nov. 2020 um 08:57 Uhr schrieb Mathieu Malaterre
> :
>
> > > > $ ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 1 -an -f null
> > > > /dev/null && \
> > > > ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 2 -c:a aac -b:a
> > > > 128k fixed.mp4
> > >
> > > This cannot work (and this is not related to the fact that you are not
> > > using a version of FFmpeg that we support here).
> > >
> > > In some cases - if you are lucky - there is a crash and no output file
> > > is written, in other cases, a "broken" output file is written, broken in
> > > the sense that two-pass encoding did not work the way it is supposed
> > > to (more bitrate was given to frames that do not need it).
> > >
> > > Do not use -an on the first pass and add "-vsync cfr" to the first pass.
> > > (Other workarounds are possible.)
> >
> > Confirmed. The above suggestion does fix the symptoms.
>
> I would say it fixes the cause.

Point taken :) I have to admit I fail to understand the root cause,
I'll do my homework and eventually figure that out. Thanks.

> > Did you base your suggestion on:
> >
> > "Error while decoding stream #0:1: Invalid data found when processing 
> > input" ?
>
> No, I know that there are many guides suggesting to use -f null for two-pass
> encoding with FFmpeg where the second pass outputs to mov, these guides
> are typically broken.

I see. I assumed that pages from domain ffmpeg.org, could be
considered universal solutions, until I realized anyone could edit it.

I've copy/pasted your comment above for the future readers:

* 
https://trac.ffmpeg.org/wiki/Encode/H.264?action=diff&version=77&old_version=76

> > > For future questions: Do not cut FFmpeg's console output, only
> > > post ffprobe output if you see an issue with it.
> > >
> > > Not really related:
> > > > Does it make sense to simply copy/paste the existing bit_rate to
> > > > re-encode it ?
> > >
> > > No, to the best of my knowledge, it makes no sense whatsoever.
> > >
> > > Very generally you either want a specific output quality, in this
> > > case specifying a bitrate and two-pass encoding make no
> > > sense.
> > > Or you have a particular size requirement for the output file,
> > > then bitrate and two-pass encoding make sense.
> >
> > Are you saying that taking the original file size as size requirement
> > is the whole issue ?
>
> Partly.
> If you need the original file size (but for example another codec) then
> two-pass encoding should provide the best quality (if done correctly).
>
> But this is an extremely unlikely use case since DVD's are less
> popular to store videos. Nowadays, what you (likely) want is to
> specify an output quality (how depends on the encoder) and let
> the encoder decide how to produce the quality you requested.

Understood. I was disappointed with something as simple as:

$ ffmpeg -i input.avi -c:v libx264 -preset slow -crf 18 -c:a copy output.mkv

Sometimes the output.mkv file was very close in size to the original
input.avi, sometimes it would double in size (again I am missing the
background to have a proper diagnosis). So I tried the two pass
solution to have a finer control.

> Carl Eugen
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".



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

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

Re: [FFmpeg-user] 2nd pass has more frames than 1st pass (99021)2kbits/s dup=27 drop=0 speed=4.76x

2020-11-29 Thread Mathieu Malaterre
Carl Eugen,

Thanks for taking the time to answer my questions.

On Sun, Nov 29, 2020 at 7:40 PM Carl Eugen Hoyos  wrote:
>
> Am So., 29. Nov. 2020 um 16:32 Uhr schrieb Mathieu Malaterre
> :
>
> > $ ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 1 -an -f null
> > /dev/null && \
> > ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 2 -c:a aac -b:a
> > 128k fixed.mp4
>
> This cannot work (and this is not related to the fact that you are not
> using a version of FFmpeg that we support here).
>
> In some cases - if you are lucky - there is a crash and no output file
> is written, in other cases, a "broken" output file is written, broken in
> the sense that two-pass encoding did not work the way it is supposed
> to (more bitrate was given to frames that do not need it).
>
> Do not use -an on the first pass and add "-vsync cfr" to the first pass.
> (Other workarounds are possible.)

Confirmed. The above suggestion does fix the symptoms.

Did you base your suggestion on:

"Error while decoding stream #0:1: Invalid data found when processing input" ?

> For future questions: Do not cut FFmpeg's console output, only
> post ffprobe output if you see an issue with it.
>
> Not really related:
> > Does it make sense to simply copy/paste the existing bit_rate to
> > re-encode it ?
>
> No, to the best of my knowledge, it makes no sense whatsoever.
>
> Very generally you either want a specific output quality, in this
> case specifying a bitrate and two-pass encoding make no
> sense.
> Or you have a particular size requirement for the output file,
> then bitrate and two-pass encoding make sense.

Are you saying that taking the original file size as size requirement
is the whole issue ?
If I follow the guide again and do the computation as described, the
bitrate value is just very slightly different:

>>> 690*8192./(3600+6*60+2) - 128
1298.673397274104

Assuming my mp3 audio did not have any particular problem, would there
be an actual difference in between using -b:v 1298k vs -b:v 1321894 ?


Thanks again,

> Carl Eugen
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".



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

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

[FFmpeg-user] 2nd pass has more frames than 1st pass (99021)2kbits/s dup=27 drop=0 speed=4.76x

2020-11-29 Thread Mathieu Malaterre
Hi there,

I am staring at the following guide to re-encode an existing avi
(mpeg4+mp3) into MP4 (h264+aac):

https://trac.ffmpeg.org/wiki/Encode/H.264#twopass

My video is such that:

$ ffprobe -show_streams -show_format -print_format json -i input.avi
[...]
Input #0, avi, from 'input.avi':
  Duration: 01:06:01.97, start: 0.00, bitrate: 1459 kb/s
Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 640x480,
1321 kb/s, 24.99 fps, 25 tbr, 24.99 tbn, 30k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo,
fltp, 127 kb/s
"streams": [
{
"index": 0,
"codec_name": "mpeg4",
"bit_rate": "1321894",
...
"index": 1,
"codec_name": "mp3",
"bit_rate": "127704",
...
"format": {
"format_name": "avi",
"bit_rate": "1459407",

Does it make sense to simply copy/paste the existing bit_rate to
re-encode it ? Or did I miss something from the guide (I find it hard
to make sense of the error message given) ?

In my case, the following command:

$ ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 1 -an -f null
/dev/null && \
ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 2 -c:a aac -b:a
128k fixed.mp4

gives:

ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1'
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
--disable-stripping --enable-avresample --disable-filter=resample
--enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libcodec2 --enable-libflite
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame
--enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
--enable-libopus --enable-libpulse --enable-librsvg
--enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
--enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi
--enable-lv2 --enable-omx --enable-openal --enable-opengl
--enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883
--enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil  56. 22.100 / 56. 22.100
  libavcodec 58. 35.100 / 58. 35.100
  libavformat58. 20.100 / 58. 20.100
  libavdevice58.  5.100 / 58.  5.100
  libavfilter 7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale  5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc55.  3.100 / 55.  3.100
[mpeg4 @ 0x563b663d7580] looks like this file was encoded with
(divx4/(old)xvid/opendivx) -> forcing low_delay flag
Input #0, avi, from 'input.avi':
  Duration: 01:06:01.97, start: 0.00, bitrate: 1459 kb/s
Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 640x480,
1321 kb/s, 24.99 fps, 25 tbr, 24.99 tbn, 30k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo,
fltp, 127 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mpeg4 @ 0x563b667c5040] looks like this file was encoded with
(divx4/(old)xvid/opendivx) -> forcing low_delay flag
[libx264 @ 0x563b667c8380] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0x563b667c8380] profile Main, level 3.0
Output #0, null, to '/dev/null':
  Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264), yuv420p, 640x480, q=-1--1,
1321 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
  encoder : Lavc58.35.100 libx264
Side data:
  cpb: bitrate max/min/avg: 0/0/1321000 buffer size: 0 vbv_delay: -1
[mpeg4 @ 0x563b667c5040] Error at MB: 11510:57:03.56 bitrate=N/A speed=12.5x
[mpeg4 @ 0x563b667c5040] I cbpc damaged at 8 27
[mpeg4 @ 0x563b667c5040] Error at MB: 1115
[mpeg4 @ 0x563b667c5040] marker does not match f_code
Last message repeated 23 times
[mpeg4 @ 0x563b667c5040] concealing 1200 DC, 1200 AC, 1200 MV errors in I frame
[mpeg4 @ 0x563b667c5a40] P cbpy damaged at 8 0:45.68 bitrate=N/A speed=12.5x
[mpeg4 @ 0x563b667c5a40] Error at MB: 8
[mpeg4 @ 0x563b667c5a40] marker does not match f_code
Last message repeated 4 times
[mpeg4 @ 0x563b667c5a40] P cbpy damaged at 22 8
[mpeg4 @ 0x563b667c5a40] Error at MB: 350
[mpeg4 @ 0x563b667c5a40] marker does not match f_code
Last message repeated 7 times
[mpeg4 @ 0x563b667c5a40] P cbpy damaged at 17 8
[mpeg4 @ 0x563b667c5a40] Error at MB: 345
[mpeg4 @ 0x563b667c5a40] marker does not match f_code
Last message repeated 5 times
[mpeg4 @ 0x563b667c5a40] concealing 1200 DC, 1200 AC, 1200 MV errors

Re: [FFmpeg-user] Repair/Fix an mpeg4 bitstream

2020-11-27 Thread Mathieu Malaterre
Carl Eugen,

On Thu, Nov 26, 2020 at 10:51 PM Carl Eugen Hoyos  wrote:
>
> Am Do., 26. Nov. 2020 um 08:58 Uhr schrieb Mathieu Malaterre
> :
>
> > I am trying to repair an mpeg4 (mastroka container with mpeg4+mp3)
> > movie. The movie runs smoothly when played with mpv, but appears to
> > have a different frame rate when played with ffplay.
> >
> > Is there a magical option to fix/repair this file ? If not how do I
> > re-encode it as-close as possible to the original one ?
> >
> > Typical output:
> >
> > $ ffmpeg -y -hide_banner -i input.mkv -c copy output.mkv
>
> When asking for help here, never use -hide_banner unless
> you want to report an issue with that option.

Understood. My point was to be as concise as possible.

> Please test current FFmpeg git head, if the issue is reproducible,
> feel free to provide a sample file.

Issue #9013

Hopefully someone will be able to make sense of the formulation
'freeze' or 'stop-and-go' I used in the issue description.

> Since the file was apparently created with FFmpeg, the more
> interesting issue is: How was the input file created?

Good question. I did not create this movie.
I was simply trying to attach metadata to this file and discovered the
non-monotonous DTS warning. I've been struggling to find a way to
re-encode it properly since.

> Carl Eugen
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".



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

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

[FFmpeg-user] Repair/Fix an mpeg4 bitstream

2020-11-25 Thread Mathieu Malaterre
Hi there,

I am trying to repair an mpeg4 (mastroka container with mpeg4+mp3)
movie. The movie runs smoothly when played with mpv, but appears to
have a different frame rate when played with ffplay.

Is there a magical option to fix/repair this file ? If not how do I
re-encode it as-close as possible to the original one ?

Typical output:

$ ffmpeg -y -hide_banner -i input.mkv -c copy output.mkv
[mpeg4 @ 0x55983b4d4900] Failed to parse extradata
Input #0, matroska,webm, from 'input.mkv':
  Metadata:
ENCODER : Lavf58.20.100
  Duration: 01:07:47.92, start: 0.00, bitrate: 1433 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile), yuv420p,
688x512 [SAR 1:1 DAR 43:32], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
Metadata:
  DURATION: 01:07:47.92000
Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 80 kb/s (default)
Metadata:
  DURATION: 01:07:47.88000
Output #0, matroska, to 'output.mkv':
  Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (FMP4 /
0x34504D46), yuv420p, 688x512 [SAR 1:1 DAR 43:32], q=2-31, 25 fps, 25
tbr, 1k tbn, 1k tbc (default)
Metadata:
  DURATION: 01:07:47.92000
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo,
fltp, 80 kb/s (default)
Metadata:
  DURATION: 01:07:47.88000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x5623e5235200] Non-monotonous DTS in output stream 0:0;
previous: 120, current: 80; changing to 120. This may result in
incorrect timestamps in the output file.
[matroska @ 0x5623e5235200] Non-monotonous DTS in output stream 0:0;
previous: 200, current: 160; changing to 200. This may result in
incorrect timestamps in the output file.
[...]
[matroska @ 0x5623e5235200] Non-monotonous DTS in output stream 0:0;
previous: 4067760, current: 4067720; changing to 4067760. This may
result in incorrect timestamps in the output file.
[matroska @ 0x5623e5235200] Non-monotonous DTS in output stream 0:0;
previous: 4067840, current: 4067800; changing to 4067840. This may
result in incorrect timestamps in the output file.
frame=101697 fps=25330 q=-1.0 Lsize=  712029kB time=01:07:47.85
bitrate=1433.9kbits/s speed=1.01e+03x
video:652268kB audio:57828kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.272119%

For reference:

$ mediainfo input.mkv
General
Unique ID:
32397768192667318044859340091939212367
(0x185F954BE5D18C685B5A2C008439CC4F)
Complete name: input.mkv
Format   : Matroska
Format version   : Version 4
File size: 695 MiB
Duration : 1 h 7 min
Overall bit rate mode: Variable
Overall bit rate : 1 434 kb/s
Writing application  : Lavf58.20.100
Writing library  : Lavf58.20.100
ErrorDetectionType   : Per level 1

Video
ID   : 1
Format   : MPEG-4 Visual
Format profile   : Advanced Simple@L5
Format settings  : BVOP1
Format settings, BVOP: 1
Format settings, QPel: No
Format settings, GMC : No warppoints
Format settings, Matrix  : Default (H.263)
Codec ID : V_MPEG4/ISO/ASP
Codec ID/Info: Advanced Simple Profile
Duration : 1 h 7 min
Width: 688 pixels
Height   : 512 pixels
Display aspect ratio : 4:3
Frame rate mode  : Constant
Frame rate   : 25.000 FPS
Color space  : YUV
Chroma subsampling   : 4:2:0
Bit depth: 8 bits
Scan type: Progressive
Compression mode : Lossy
Writing library  : XviD 1.2.0.dev47 (UTC 2006-11-01)
Default  : Yes
Forced   : No

Audio
ID   : 2
Format   : MPEG Audio
Format version   : Version 1
Format profile   : Layer 3
Format settings  : Joint stereo
Codec ID : A_MPEG/L3
Codec ID/Hint: MP3
Duration : 1 h 7 min
Bit rate mode: Variable
Channel(s)   : 2 channels
Sampling rate: 48.0 kHz
Compressi