6

Is it possible to remove certain information form a MP4 file? Specifically things like tagging and encoding dates, Writing library and application, Encoding settings... No client needs to know when I encoded something or what software and settings I've used.

My only guess was to remux the file with ffmpeg, but that only gets rid of the dates and replaces the writing application info with the more generic Lavf.

I'm on Windows, btw, but MacOS and Linux (Ubuntu) would work as well.

2 Answers 2

6

Regular ffmpeg won't do this. You'll need a combination of two tools to carry this out.

#1 Use ffmpeg from direct264, a modded version of an old ffmpeg build with a custom filter to modify H264 bitstreams. This build is crippled in most other ways, so rename it or don't put it in your path.

ffmpeg -i in.mp4 -vcodec copy -acodec copy -vbsf h264_changesps=removesei -map_metadata -1 out.mp4

#2 Use mp4box from the GPAC suite to strip the writing application metadata

mp4box -add out.mp4 -new stripped.mp4
13

Use bitstream filter filter_units with ffmpeg 4.0 or newer.

ffmpeg -i INPUT -c copy -bsf:v 'filter_units=remove_types=6' OUTPUT

P.S.

/* NAL unit types */
enum {
    H264_NAL_SLICE           = 1,
    H264_NAL_DPA             = 2,
    H264_NAL_DPB             = 3,
    H264_NAL_DPC             = 4,
    H264_NAL_IDR_SLICE       = 5,
    H264_NAL_SEI             = 6,
    H264_NAL_SPS             = 7,
    H264_NAL_PPS             = 8,
    H264_NAL_AUD             = 9,
    H264_NAL_END_SEQUENCE    = 10,
    H264_NAL_END_STREAM      = 11,
    H264_NAL_FILLER_DATA     = 12,
    H264_NAL_SPS_EXT         = 13,
    H264_NAL_AUXILIARY_SLICE = 19,
};
1
  • 1
    Yes, this is now directly possible.
    – Gyan
    May 13, 2019 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.