<p>Joakin, what you have suggested in your Update 2 is remuxing. Alternatively to what you have suggested <a href="https://superuser.com/a/1572216/1106742">atom manual editing</a> can be utilized.</p>
<p>Manual editing is</p>
<p>(a) much faster - just the metadata is modified</p>
<p>(b) can be applied both ways - to scale up and to scale down. I have persinally succeeded in decreasing length by remuxing, but i failed in increasing it.</p>

CC BY-SA 4.0
2021-12-12T18:48:03.497Z
2021-12-12T18:48:03.497Z
kirilloffs
<p>I had the same problem. I solved that by removing the audio from video.
This is why the video seems frozen but it continues to play it, due to audio duration. </p>

<p>For that reason, you may remove entire audio from video file using "-an" ffmpeg option. When it removed, no incorrect time in video exists. You may extract audio from the initial video file, match its duration time with the video duration, and then, you encode video and audio files together, resulting no frozen video frames play. </p>

<p>eg. </p>

<pre><code>ffmpeg -i video_to_encode.MP4  -r 16 -crf 18  -vcodec libx264 -vb 10M -an  video_output.avi
</code></pre>

CC BY-SA 4.0
2020-06-01T06:50:21.417Z
2020-06-01T06:50:21.417Z
Estatistics
<p>I also faced with this issue and I had to add <code>-vcodec libx264</code> in addition to <code>-an</code>. Cutting a video:</p>
<pre><code>ffmpeg -ss {sec2time(start)} -to {sec2time(end)} -i {video_path} -c copy -vcodec libx264 -an {save_path}
</code></pre>

CC BY-SA 4.0
2023-02-18T19:45:27.077Z
2023-02-18T19:45:27.077Z
Yunus Emre
<p>I'm having a film that's ffmpeg and other progs claims to be 07:03:52 long, but the real playtime is actually more like 2:35:00</p>

<pre><code>ffprobe video.mp4
ffprobe version 3.0.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-17) 20160429
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libtesseract --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mipsdsp --disable-mips32r2 --disable-msa --disable-mipsfpu --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libbs2b --enable-libilbc --enable-libopenh264 --enable-libkvazaar --enable-libsnappy --enable-libsoxr --enable-libiec61883 --enable-vaapi --enable-opencl --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2012-12-12 07:03:52
  Duration: 07:13:45.09, start: 0.000000, bitrate: 274 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x528 [SAR 1:1 DAR 80:33], 601 kb/s, 23.98 fps, 23.98 tbr, 96k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2012-12-12 07:03:52
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 92 kb/s (default)
    Metadata:
      creation_time   : 2012-12-12 07:04:15
      handler_name    : GPAC ISO Audio Handler
</code></pre>

<p>Is there any one who can help me fix the playtime / duration with a terminal command on debian/centos </p>

<p>I have HandBrake-cli + FFmpeg installed</p>

<p>UPDATE
Thought: since the video plays perfectly in various players and the frame-rate is right, how comes, that encoders like HandBrake and ffmpeg can't calculate the right duration?</p>

<p>UPDATE 2 - Solution
I duckduckgo.com it and found a usable solution on a well.. torrent site</p>

<pre><code>ffmpeg -i video.mp4 -t 2:09:39 -c:v copy -c:a copy -c:s copy out.mp4
</code></pre>

<p>How ever, this is not an repairing or any acclimatisation of the job, but it worked.</p>

<p>So summon up what this does</p>

<ul>
<li><code>ffmpeg</code> - Video encoder</li>
<li><code>-i</code> source video</li>
<li><code>-t</code> <a href="https://ffmpeg.org/ffmpeg.html" rel="noreferrer">When used as an input option (before -i), limit the duration of data read from the input file.</a></li>
<li><code>-c:v</code> + <code>-c:a</code> copy video+audio from source</li>
<li>output file</li>
</ul>

<p>Any optimization or acclimatisation of this workload is still welcome</p>

CC BY-SA 3.0
2016-11-09T18:54:32.950Z
`07:03:52` is being reported as the creation time, although the estimated duration is `07:13:45.09`. Try a remux: `ffmpeg -i video.mp4 -c copy out.mp4`
Gyan
CC BY-SA 3.0
2016-11-09T19:25:48.190Z
Hi @Mulvya thx for your replay and suggestion, tried this, but it gives the same playtime error. Did also try to convert it to other formats like webm, avi, mov etc... same thing :(
Joakim
CC BY-SA 3.0
2016-11-10T02:34:59.107Z
Except for the manual time option, your solution is the same as mine. Run `ffprobe video.mp4 -show_entries stream=codec_type,start_time,duration -of compact` and show the output.
Gyan
CC BY-SA 3.0
2017-01-07T16:26:59.753Z
Hi thought I had replied to this thread, but I did find the solution by using the -s -ss options to simply cut the length of the video and now it's playing lovely
Joakim
CC BY-SA 4.0
2019-08-06T08:02:02.700Z
Refer to [Format (container) duration](https://trac.ffmpeg.org/wiki/FFprobeTips#Formatcontainerduration)
LF-DevJourney
CC BY-SA 4.0
2021-05-17T22:48:25.680Z
The command from Update 2 worked like a charm... Stargate is a great movie isn't it?
Nick
<ffmpeg><mp4><handbrake>
Howto Repaire or fix the duration of a mp4 video
Joakim
# Howto Repaire or fix the duration of a mp4 video

(Asked by: username_0 on 2016-11-09)

I'm having a film that's ffmpeg and other progs claims to be 07:03:52 long, but the real playtime is actually more like 2:35:00
ffprobe video.mp4
ffprobe version 3.0.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-17) 20160429
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libtesseract --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mipsdsp --disable-mips32r2 --disable-msa --disable-mipsfpu --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libbs2b --enable-libilbc --enable-libopenh264 --enable-libkvazaar --enable-libsnappy --enable-libsoxr --enable-libiec61883 --enable-vaapi --enable-opencl --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2012-12-12 07:03:52
  Duration: 07:13:45.09, start: 0.000000, bitrate: 274 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x528 [SAR 1:1 DAR 80:33], 601 kb/s, 23.98 fps, 23.98 tbr, 96k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2012-12-12 07:03:52
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 92 kb/s (default)
    Metadata:
      creation_time   : 2012-12-12 07:04:15
      handler_name    : GPAC ISO Audio Handler

Is there any one who can help me fix the playtime / duration with a terminal command on debian/centos 
I have HandBrake-cli + FFmpeg installed
UPDATE
Thought: since the video plays perfectly in various players and the frame-rate is right, how comes, that encoders like HandBrake and ffmpeg can't calculate the right duration?
UPDATE 2 - Solution
I duckduckgo.com it and found a usable solution on a well.. torrent site
ffmpeg -i video.mp4 -t 2:09:39 -c:v copy -c:a copy -c:s copy out.mp4

How ever, this is not an repairing or any acclimatisation of the job, but it worked.
So summon up what this does

ffmpeg - Video encoder
-i source video
-t When used as an input option (before -i), limit the duration of data read from the input file.
-c:v + -c:a copy video+audio from source
output file

Any optimization or acclimatisation of this workload is still welcome

**Tags:** ffmpeg, mp4, handbrake

> **Comments:**
> **username_1**: `07:03:52` is being reported as the creation time, although the estimated duration is `07:13:45.09`. Try a remux: `ffmpeg -i video.mp4 -c copy out.mp4`  
> **username_0**: Hi @Mulvya thx for your replay and suggestion, tried this, but it gives the same playtime error. Did also try to convert it to other formats like webm, avi, mov etc... same thing :(  
> **username_1**: Except for the manual time option, your solution is the same as mine. Run `ffprobe video.mp4 -show_entries stream=codec_type,start_time,duration -of compact` and show the output.  
> **username_0**: Hi thought I had replied to this thread, but I did find the solution by using the -s -ss options to simply cut the length of the video and now it's playing lovely  
> **username_2**: Refer to [Format (container) duration](https://trac.ffmpeg.org/wiki/FFprobeTips#Formatcontainerduration)  
> **username_3**: The command from Update 2 worked like a charm... Stargate is a great movie isn't it?  

---

## 3 answers

### Answer by username_4 on 2021-12-12. Score: 2

Joakin, what you have suggested in your Update 2 is remuxing. Alternatively to what you have suggested [atom manual editing](https://superuser.com/a/1572216/1106742) can be utilized.

Manual editing is

(a) much faster - just the metadata is modified

(b) can be applied both ways - to scale up and to scale down. I have persinally succeeded in decreasing length by remuxing, but i failed in increasing it.


---

### Answer by username_5 on 2020-06-01. Score: 1

I had the same problem. I solved that by removing the audio from video.
This is why the video seems frozen but it continues to play it, due to audio duration. 
For that reason, you may remove entire audio from video file using "-an" ffmpeg option. When it removed, no incorrect time in video exists. You may extract audio from the initial video file, match its duration time with the video duration, and then, you encode video and audio files together, resulting no frozen video frames play. 
eg. 
ffmpeg -i video_to_encode.MP4  -r 16 -crf 18  -vcodec libx264 -vb 10M -an  video_output.avi


---

### Answer by username_6 on 2023-02-18. Score: 1

I also faced with this issue and I had to add -vcodec libx264 in addition to -an. Cutting a video:
ffmpeg -ss {sec2time(start)} -to {sec2time(end)} -i {video_path} -c copy -vcodec libx264 -an {save_path}


---

