[FFmpeg-user] concat demuxer and 'strange' mp4s with wrong TBN

Gabriele Greco gabriele.greco at wyscout.com
Wed Aug 22 10:21:13 EEST 2018


I have problems to concatenate with the concat demuxer two mp4, that
individually play fine but the second one has wrong time base information
in the context:

I tried both with 3.4.1 version of ffmpeg and the SVN one.

Extracting relevant infos with ffprobe I found that:

file1.mp4 has the following video track:
    Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5000 kb/s, 30 fps, 30 tbr, 600 tbn,
30 tbc (default)

file2.mp4 has the following video track:
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 4979 kb/s, 30 fps, 30 tbr, 15360 tbn,
30 tbc (default)

As you can see TBN for the second file is wrong, don't ask me why, we get
videos of every format from our customers...

Both files play fine in VLC and other players since I think they use TBR (the
time base in AVCodecContext) or TBC (the guessed one) instead of TBN (the
time base in AVStream) for the playback, the problem is that the concat
demuxer uses TBN and this is clear by the fact that during the concat
operation my progress and bitrate jump when the input switch to the second
file:

frame=10423 fps=2670 q=-1.0 size=  217600kB time=00:05:47.49
bitrate=5129.8kbits/s speed=  89x
frame=29581 fps=2997 q=-1.0 size=  617472kB time=00:16:26.04
bitrate=5129.9kbits/s speed=99.9x
frame=57845 fps=3131 q=-1.0 size= 1207296kB time=00:32:08.17
bitrate=5129.3kbits/s speed= 104x
frame=79035 fps=3176 q=-1.0 size= 1649664kB time=00:43:54.55
bitrate=5129.5kbits/s speed= 106x
[ ... here the concat demuxer switches to the second file .. ]
frame=91329 fps=3170 q=-1.0 size= 1901824kB time=21:38:57.30 bitrate=
199.9kbits/s speed=2.71e+03x
frame=101922 fps=3179 q=-1.0 size= 2123008kB time=24:09:36.66 bitrate=
200.0kbits/s speed=2.71e+03x
frame=112519 fps=3192 q=-1.0 size= 2344192kB time=26:40:19.43 bitrate=
200.0kbits/s speed=2.72e+03x
frame=151570 fps=3220 q=-1.0 size= 3155200kB time=35:55:44.18 bitrate=
199.8kbits/s speed=2.75e+03x
frame=171012 fps=3235 q=-1.0 Lsize= 3566188kB time=40:32:14.69 bitrate=
200.2kbits/s speed=2.76e+03x

inputs.txt:
file 'file1.mp4'
file 'file2.mp4'

usual call:
ffmpeg -f concat -safe 0 -i inputs.txt -c copy test.mp4

I tried also to add -fflags +genpts but it doesnt change anything:
ffmpeg -fflags +genpts -f concat -safe 0 -i inputs.txt -c copy test.mp4

MY QUESTION
there is a way, also patching sources, to force concat demuxer to use tbc
for his calculations instead of TBN if the TBN of one of the files is
clearly wrong?

-- 
*Gabriele Greco*

*Senior Software Engineer - Mobile Division*Mobile: *+39 3391941700*
Website:  www.wyscout.com
[image: Descrizione: Descrizione: Descrizione: Descrizione:
Logo_Wyscout_Nero_firma]

-- 


Le informazioni contenute nella presente comunicazione e i relativi 
allegati possono essere riservate e sono, comunque, destinate 
esclusivamente alle persone o alla Società sopraindicati e non sono da 
considerarsi comunicazioni personali, quindi eventuali risposte potranno 
essere conosciute da persone appartenenti all’azienda. La diffusione, 
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi 
soggetto diverso dal destinatario è proibita ai sensi dell’art. 616 c.p. I 
dati forniti verranno trattati ai sensi dell'art. 13 del Regolamento UE 
2016/679 (normativa sulla privacy). Se ha ricevuto questo messaggio per 
errore Ti preghiamo di distruggerlo e di informarci immediatamente 
contattandoci mandando una mail a privacy at wyscout.com 
<mailto:privacy at wyscout.com>. Copia integrale dell’informativa potrà essere 
visionata presso le nostre sedi. 

Any information herein included (even 
any attachments) shall be considered confidential and/or privileged 
material and meant to be only for the abovementioned persons and/or 
Company, therefore such communication is intended to be for the addressee 
only. Such information is not personal, that is why this e-mail and any 
replies may be known exclusively by people belonging to the company. It is 
expressively not allowed communicate, disclose and/or copy any 
documentation transmitted by a person other than the recipient, according 
to the Italian Criminal Code, Section 616 and the Regulation EU 2016/679. 
Your provided data are processed in accordance with Regulation EU 2016/679 
(Data Protection Law), Section 13. A full copy of the relevant information 
notice is available at the company’s registered office upon request. If you 
received this in error, please destroy it and inform us immediately by 
sending an e-mail to the following e-mail address privacy at wyscout.com 
<mailto:privacy at wyscout.com>. A full copy of the relevant information 
notice is available at the company’s registered office upon request.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: application/octet-stream
Size: 2845 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20180822/d48677d8/attachment.obj>


More information about the ffmpeg-user mailing list