Process MP4s audio muxed incorrectly with DTS header

Questions and answers on how to get the most out of FFAStrans
Post Reply
silicontrip
Posts: 54
Joined: Thu Sep 22, 2016 7:12 am

Process MP4s audio muxed incorrectly with DTS header

Post by silicontrip »

Hi There,

We've encountered mp4 files where the audio has been incorrectly muxed with a DTS header. FFAStrans produces files with choppy out of sync audio.

ffmpeg is able to fix these files with use of the bitstream filter "aac_adtstoasc"

Code: Select all

ffmpeg -i broken.mp4 -acodec copy -vcodec copy -bsf:a aac_adtstoasc fixed.mp4
Is it possible to detect these files and include this bitstream filter in FFAStrans?

Thanks
Mark
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Process MP4s audio muxed incorrectly with DTS header

Post by admin »

Are there any particular scenarios where FFAStrans creates these faulty files? And I assume you're using the "MP4"-encoder?

Anyway, you can use the "Custom FFmpeg"-encoder node to create your own encoder setup. Your issue should be trivial to fix using this method :-)

-steinar
silicontrip
Posts: 54
Joined: Thu Sep 22, 2016 7:12 am

Re: Process MP4s audio muxed incorrectly with DTS header

Post by silicontrip »

FFASTrans does not create these files. I am referring to source files that have been incorrectly created by other programs, which we are trying to transcode into XDCAM.

Currently FFAStrans transcodes these files without reporting an error but the resulting audio is out of sync and "choppy" these files first must be processed by ffmpeg to correct the audio. Would it be possible to detect these types of files and run the ffmpeg fix as a processor?

Thanks
Mark
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Process MP4s audio muxed incorrectly with DTS header

Post by admin »

Have you tried running these files without the "A/V Media"-decoder node?
If you could share with me some file(s) that initiates the issue it would be easier for me to investigate the possibility to pick up these anomalies.

-steinar
silicontrip
Posts: 54
Joined: Thu Sep 22, 2016 7:12 am

Re: Process MP4s audio muxed incorrectly with DTS header

Post by silicontrip »

I hooked the Folder watcher directly to the XDCAM encoder. The audio sounds correct (not choppy) but still has synchronization issues with the video. The video appears to be dropping frames. The source files are clearly incorrect. I have not found a transcoder that can deal with them properly.

https://www.dropbox.com/s/f80ojtkgm61x2 ... ond-22.mp4

the only way I've been able to detect these files is with the following ffmpeg command;

Code: Select all

ffmpeg -i m-mh-football-richmond-22.mp4 -vcodec copy -acodec copy out.mp4
which produces the following error;

Code: Select all

[mp4 @ 0x7fa91a020600] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Operation not permitted
Mark
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Process MP4s audio muxed incorrectly with DTS header

Post by admin »

Hi Mark and thank you for sharing the problem file :-)

I've been looking it and the video seem to have has variable frame rate balancing at around 24.98 fps. There are also some bad PTS but that may just be due to the variable fps?. "Fixing" the video using using the bitstream filter in ffmpeg cause the framerate to drop to around 24.93. So you will still have a problem with some encoders. However, I've been able to get good decoding and encoding using the "A/V Media"-decoder in intelligent mode. The audio and video is in sync and not choppy using and XDCAM 35 mbit, 50i fps mxf profile. At least not what I can see or hear. I have checked the file using Premiere 9 looking at frame by frame and carefully looking at sync.

Anyway, I will take a look at how I can further improve picking up failed conversions and your issue will be very helpfull in this regard! :-)

-steinar
silicontrip
Posts: 54
Joined: Thu Sep 22, 2016 7:12 am

Re: Process MP4s audio muxed incorrectly with DTS header

Post by silicontrip »

Maybe it was the different encoder I was trying before getting bmxtranswrap installed.
I've checked these clips and they sound OK now.

Mark
Post Reply