VideoHelp Forum




+ Reply to Thread
Results 1 to 22 of 22
  1. Some MP4 video files I downloaded, have problems. (They are not encrypted btw)

    I downloaded them with IDM, yt-dlp, aria2, nothing changed, it always ended up with a video with a corrupted timezone.

    Online watching experience in the web browser: When it comes to that bad frame, video playback stops and HTML5 Video Player goes back to the beginning of the video.

    Offline watching experience in PotPlayer: When it comes to that bad frame, video playback stops and PotPlayer shuts down itself.

    When I open those MP4s with MediaInfo, video duration is reported much more shorter. And it's the timezone where I get the error. 4 min 12 secs, for example, or 57 min 56 secs. The video is actually 2 hours long.

    When I try to add its audio track to that video file, audio never gets synched with the video.

    When I extract the video with FFmpeg, corrupted frames become frozen frames, you have to skip those frames manually to resume the video playback.

    Is there a good solution for those files?

    I think they are uploaded to the server like that. How can I remove a few frozen frames without any re-encoding and without paying money?
    Quote Quote  
  2. Originally Posted by ridibunda View Post
    How can I remove a few frozen frames without any re-encoding
    Most likely, you can't.
    click click2
    If I/my posts ever helped you, and you want to give back, send me a private message!
    Quote Quote  
  3. You can probably remove the entire GOP though. That may be anywhere from half a second to 10 seconds or more.
    Quote Quote  
  4. I think the easiest editor for this is AviDemux. Open the MP4 file. Navigate to the I frame just before the bad frames using the slider or the up/down arrow keys. Press the A button (mark-in). Navigate to the I frame just after the bad frames. Press the B button (mark-out). Select Edit -> Cut. Make sure Video and Audio are set to Copy, and Output Format is set to MP4. The select File -> Save. In a few seconds you'll have a new video without the bad GOP.
    Quote Quote  
  5. I imported the file into AviDemux. AviDemux says that it is 57 min 58 secs.

    PotPlayer's playlist shows it as complete (1 hours 44 mins 37 secs). But as I wrote before, it shuts down at 00:57:58, where our bad frame is located. Before coming to that point, I jump to 58th minutes at least, video playback resumes without any problem.

    With MKVToolnix, I tried to cut the 00:00:00-00:57:58 part and 00:57:59-01:44:37 part, and later join them, but it deleted 10-15 seconds of the video.

    I know that bad GOP is only 1 second. If I start the playback at exactly 00:57:59, no problem then. Only 1 second has to be deleted and AviDemux does not recognise the whole video.
    Quote Quote  
  6. Maybe a simple remux cold help.
    Quote Quote  
  7. Originally Posted by ridibunda View Post
    I imported the file into AviDemux. AviDemux says that it is 57 min 58 secs.
    It will probably be the best to upload the video and audio somewhere and post links so people can actually check for themselves.
    click click2
    If I/my posts ever helped you, and you want to give back, send me a private message!
    Quote Quote  
  8. Originally Posted by ridibunda View Post
    I know that bad GOP is only 1 second. If I start the playback at exactly 00:57:59, no problem then.
    That doesn't mean the GOP with the bad frame is only one second. It could be 10 or 15 seconds long but playable up until the bad frame(s), one second before the end of the GOP. But most non-reencoding tools will only cut on keyframes. So you'll lose the entire GOP. That's probably what MkvToolNix did.
    Quote Quote  
  9. Originally Posted by jagabo View Post
    That doesn't mean the GOP with the bad frame is only one second. It could be 10 or 15 seconds long but playable up until the bad frame(s), one second before the end of the GOP. But most non-reencoding tools will only cut on keyframes. So you'll lose the entire GOP. That's probably what MkvToolNix did.
    So, what must be done not to lose 15 seconds?

    In MeGUI, Lsmashworks indexes a 57-mins-video. Re-encoding will give me a 57-mins video. It will be a waste of time.

    VirtualDub2 reports a complete duration under "File > File Information". I don't know what will happen after re-encoding.

    It's a pity that the HD version is only at that website. I sent an e-mail about the issue, and they did not pay any attention.
    Quote Quote  
  10. With VirtualDub2 can you seek past the bad frames and see/play the rest of the video? If so, you can do something similar to the process I gave for AviDemux. Mark-in just before the bad frames, mark out at the start of the next GOP, Edit -> Cut. Then export what's left. I don't think it will let you Direct Stream Copy the video from MP4 files though, you'll have to reencode.
    Quote Quote  
  11. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Personally, if you have Avisynth installed, I use the following script and save it as .AVS and then drop on my favorite player with frame by frame capabilties.
    Just need to adjust the Pathe and name of video and change Atrack to -2 if there is no audio.

    Code:
    ffmpegsource2("C:\Users\Bud\Desktop\Slide.mp4", atrack=-1).converttoRGB
    x = float(Width) / float(Height)
    last.LanczosResize(round(x * 480.0 / 4.0) * 4, 480)
    ShowFrameNumber(scroll=True, x=10, y=127, font="Arial", size=24, text_color=$ffff80)
    ShowTime(x=72, y=144, font="Arial", size=24, text_color=$ffff80)
    ScriptClip(Last, """Subtitle("[ "+Chr(FFPICT_TYPE)+" ]"+"  " +String(current_frame), size=(Height*56.0/720), align=3)""", after_frame=True)
    You receive a video that you can find the frame number, what the frame type is etc. to make cutting easier.
    Image
    [Attachment 63563 - Click to enlarge]
    Quote Quote  
  12. VirtualDub2 cannot play from 57:56 to 58:06. I marked that unplayable/unreadable segment, cut it.

    Then tried to save the file with video-stream copy option, it says:

    "Direct stream copy cannot be used with this video stream. You may want to select different Input Driver"

    "File > Export > Stream Copy" method also didn't work, it gave me a file less than 1 KB.

    Scanned for unreadable frames, it didn't even give a log file.
    Quote Quote  
  13. Originally Posted by Budman1 View Post
    Personally, if you have Avisynth installed, I use the following script and save it as .AVS and then drop on my favorite player with frame by frame capabilties.
    Just need to adjust the Pathe and name of video and change Atrack to -2 if there is no audio.

    Code:
    ffmpegsource2("C:\Users\Bud\Desktop\Slide.mp4", atrack=-1).converttoRGB
    x = float(Width) / float(Height)
    last.LanczosResize(round(x * 480.0 / 4.0) * 4, 480)
    ShowFrameNumber(scroll=True, x=10, y=127, font="Arial", size=24, text_color=$ffff80)
    ShowTime(x=72, y=144, font="Arial", size=24, text_color=$ffff80)
    ScriptClip(Last, """Subtitle("[ "+Chr(FFPICT_TYPE)+" ]"+"  " +String(current_frame), size=(Height*56.0/720), align=3)""", after_frame=True)
    You receive a video that you can find the frame number, what the frame type is etc. to make cutting easier.
    Image
    [Attachment 63563 - Click to enlarge]
    Tried it. PotPlayer does not open it.

    VirtualDub2 says:

    "test.avs does not have a video stream"

    Avisynth+3.7.1 installed.
    Quote Quote  
  14. Originally Posted by ridibunda View Post
    "Direct stream copy cannot be used with this video stream. You may want to select different Input Driver"
    As noted, Direct Stream Copy does not work with MP4 files. You'll have to reencode. Set Video -> Full Processing Mode. Then Video -> Compression... Select and configure a codec*. Then File -> Save Video...


    * Note that audio will also be decomrpessed with an MP4 source. So if you want it compressed you'll need to select Audio -> Full Processing Mode and select/configure an audio codec.
    Last edited by jagabo; 26th Feb 2022 at 06:54.
    Quote Quote  
  15. If you can remux the mp4 to AVI with ffmpeg you can use VirtualDub2 in Direct Stream Copy mode. But I suspect the remux will abourt at the bad frames.
    Quote Quote  
  16. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Tried it. PotPlayer does not open it.

    VirtualDub2 says:

    "test.avs does not have a video stream"

    Avisynth+3.7.1 installed.
    Be sure you use complete paths. If player can't find it, it will have no video and report as such. Just a note as to why it might not work...
    Quote Quote  
  17. Found a command-line for removing corrupted parts:

    ffmpeg -i video.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB -an video-fixed.mp4

    The process is so slow, only 12 frames per second. It will take several hours to complete.

    I will also try the method @jagabo wrote and see which is the best.
    Quote Quote  
  18. Originally Posted by ridibunda View Post
    Found a command-line for removing corrupted parts:

    ffmpeg -i video.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB -an video-fixed.mp4

    The process is so slow, only 12 frames per second. It will take several hours to complete.
    That's because you're reencoding the video. The default codec for MP4 output is x264 with the medium preset and crf=23.

    Although that filter sequence might fix a corrupt video as a side effect it's not explicitly intended to do so. It removes duplicate frames creating a variable frame rate video with new time stamps. It may crash at corrupt frames just like many other programs.
    Quote Quote  
  19. Originally Posted by jagabo View Post
    That's because you're reencoding the video. The default codec for MP4 output is x264 with the medium preset and crf=23.

    Although that filter sequence might fix a corrupt video as a side effect it's not explicitly intended to do so. It removes duplicate frames creating a variable frame rate video with new time stamps. It may crash at corrupt frames just like many other programs.

    I said "so slow", because I expected a real-time (20-25 fps) encoding speed (like other 1080p videos I re-encoded before)

    When it dropped to 10 fps, I aborted the process.

    Average bitrate was 3400 kbps, I see that ffmpeg increased it to 4400 kbps. That's my other reason to abort.

    I will re-encode it with VirtualDub2 at the same bitrate. It won't save the video, anyway.
    Quote Quote  
  20. Member
    Join Date
    Aug 2004
    Location
    PA USA
    Search Comp PM
    When it dropped to 10 fps, I aborted the process.
    Video editing is a slow process, why would you settle for a lower bitrate?, unless you've got a quantum computer dedicated to your project, or you have the latest Threadripper or Xeon's, it's going to be slow. I recently did some Flowframe tests where a 50-minute video took 19 hours. I waited; the results were outstanding. Your mileage may vary.
    It's not important the problem be solved, only that the blame for the mistake is assigned correctly
    Quote Quote  
  21. I still don't understand why a stream-service releases such corrupted videos (Not encrypted, but corrupted). If that happened at Netflix or Amazon, it would be a worldwide scandal.

    I decided that re-encoding will just be a waste of time. In all cases, I'll lose 15-20 seconds of video and the original video quality. And it will take longer than expected.

    I will wait for the stream-service to replace the corrupted video with a fresh one. Sad to see there is no other solution.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!