Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


changing timecode in an .mp4-file

Discussions about problems encountered using ffmpeg.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

changing timecode in an .mp4-file

Postby BenSuper » Tue Jan 31, 2017 2:04 pm

Hi I am trying to change the timecode in an existing .mp4 file, without copying or outputting it to another file. How can I safe the file, after I worte this?:

Code: Select all
ffmpeg -i /Volumes/TRY/0001.MP4  -timecode 01:02:03.04 (..?)


Thanks for any hint.
BenSuper
 
Posts: 3
Joined: Tue Jan 31, 2017 1:57 pm

Re: changing timecode in an .mp4-file

Postby mulvya » Tue Jan 31, 2017 3:31 pm

You can't. Not with ffmpeg.

With ffmpeg, at best, you can do

Code: Select all
ffmpeg -i /Volumes/TRY/0001.MP4  -timecode 01:02:03.04 -c copy out.mp4


There is another way, but it's use at your own risk. It involves using a hex editor to alter the timecode, which is stored as 4 bytes. You open the MP4 in a hex editor, search for the string mdat. The next 4 bytes are the timecode. The value stored is the timecode converted to # of frames. So for 01:02:03:04 at 25 fps, the frame index is 93079. Converted to Hex, it is 00 00 91 72. That's what you need to plug in. USE AT YOUR OWN RISK.
mulvya
 
Posts: 534
Joined: Mon Oct 26, 2015 6:58 am

Re: changing timecode in an .mp4-file

Postby BenSuper » Tue Jan 31, 2017 4:07 pm

Thanks a lot for the fast answer mulvya! Copying is good enough for me. I tried your command line but I got the following response:

Code: Select all
[mp4 @ 0x7f810c017c00] Drop frame is only allowed with 30000/1001 or 60000/1001 FPS
[mp4 @ 0x7f810c017c00] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argumentStream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times


What am I doing wrong?
BenSuper
 
Posts: 3
Joined: Tue Jan 31, 2017 1:57 pm

Re: changing timecode in an .mp4-file

Postby mulvya » Tue Jan 31, 2017 4:21 pm

FFmpeg does not write PCM audio streams in MP4. MOV is fine. Change . to : in timecode for non-drop FPS files.
mulvya
 
Posts: 534
Joined: Mon Oct 26, 2015 6:58 am

Re: changing timecode in an .mp4-file

Postby BenSuper » Tue Jan 31, 2017 4:29 pm

Alright, that worked! Thanks very much.
BenSuper
 
Posts: 3
Joined: Tue Jan 31, 2017 1:57 pm

Re: changing timecode in an .mp4-file

Postby dreuxzer » Thu Apr 06, 2017 8:17 pm

Hey mulvya, is there a similar indicator within the hex of a .MPG file?

Thanks,
Dreux
dreuxzer
 
Posts: 3
Joined: Thu Apr 06, 2017 6:46 pm


Return to ffmpeg

Who is online

Users browsing this forum: No registered users and 8 guests