<p>I would determine if this is a corrupt file or a corrupt disk. A "read error" sounds like a bad disk to me. If that is the case you probably have bigger problems than reading that video file. I would suggest doing a complete backup of the disk. You can use dd_rescue (or ddrescue) for that purpose which doesn't stop on bad sectors but makes a copy of everything readable on the disk. Once you have got that done, you can take care of the video file on the backup disk.</p>

<p><a href="http://www.garloff.de/kurt/linux/ddrescue/" rel="nofollow">http://www.garloff.de/kurt/linux/ddrescue/</a>
<a href="https://www.gnu.org/software/ddrescue/" rel="nofollow">https://www.gnu.org/software/ddrescue/</a></p>

<p>If the disk is on the verge of failing, the worst you can do is continuing  to use it  since it may stop working completely anytime soon.</p>

CC BY-SA 3.0
2016-03-11T09:28:27.437Z
I checked the disk using `badblocks`, and it showed no errors, thus I assume that the disk is still ok. How can I fix the corrupt file then?
arc_lupus
CC BY-SA 3.0
2016-03-11T09:36:26.840Z
did you check SMART results as well? See this thread: https://lime-technology.com/forum/index.php?PHPSESSID=4759db970e485a7c450a3dfd7e41ed9d&amp;amp;topic=23792.0
Hans Meiser
CC BY-SA 3.0
2016-03-11T09:46:05.983Z
If you are positive there is no read errors on the disk, I'd try to make a copy of the file and see how that copy behaves in VLC.
Hans Meiser
CC BY-SA 3.0
2016-03-11T10:26:49.560Z
Unfortunately the external hard disk does not support SMART, at least according to `gnome-disks`
arc_lupus
CC BY-SA 3.0
2016-03-11T10:46:08.527Z
The copy does not behave differently, it still freezes at the same point
arc_lupus
CC BY-SA 3.0
2016-03-11T11:02:19.460Z
But unless I missed something, that means your disk has read errors. If you don't care about making a backup of the entire disk, try to use dd_rescue or ddrescue on that file only.
Hans Meiser
CC BY-SA 3.0
2016-03-11T12:43:13.767Z
Is there a way to test the disk (non-destructively) if there are read-errors except with `badblocks` which did not report any errors?
arc_lupus
CC BY-SA 3.0
2016-03-11T12:45:48.253Z
I guess you cannot read out the SMART stats because the disk is in an external enclosure? If so, you could take out the disk from the enclosure and connect it internally to your computer. Unless the drive is older than 10years or so, I would assume it has smart internally but you cannot access it?
Hans Meiser
CC BY-SA 3.0
2016-03-11T12:48:22.373Z
The disk itself reports that it is unable to use SMART, but that could also be related to the USB connection. I will try that at a second computer.
arc_lupus
CC BY-SA 3.0
2016-03-10T01:19:44.607Z
2016-03-10T01:33:26.640Z
2016-03-10T01:33:26.640Z
Hans Meiser
<p>I've recently had some success with this problem.   In my case I was receiving the error converting from MKV to MP4.  The cause of the issue was that the process that created the MKV file failed silently when I ran out of disk space so the source feed to ffmpeg was already corrupt; the error was indicating there was no data to convert beyond that point in the source.</p>

<p>Fortunately I was able to recreate the MKV from it's source (after freeing up disk space of course).</p>

<p>Further, as mentioned in Mulvya's comment on your question, the "2" here seems to be what the command is complaining about.</p>

CC BY-SA 3.0
2017-07-28T03:45:22.997Z
2017-07-28T03:45:22.997Z
Zodman
<p>I have several videos which produce reading errors in ffmpeg, thus hindering me to play them in VLC (for example). Is there a way to either skip those problematic parts, or to fix them?<br>
The exact error is:</p>

<pre><code>[matroska,webm @ 0x3a13a20] Read error at pos. 11794050343 (0x2befaed27)
[NULL @ 0x3a18380] Unable to find a suitable output format for '2'
2: Invalid argument
</code></pre>

<p>generated by the command <code>ffmpeg -v error -i "sample.mkv" -map 0:1 -f null - 2</code></p>

<p>The video itself has the following encoding (by <code>mediainfo</code>):</p>

<pre><code>Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2h 1mn
Bit rate                                 : 10.8 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 040 pixels
Display aspect ratio                     : 1.85:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.227
Stream size                              : 8.95 GiB (81%)
Writing library                          : x264 core 59 r819M 0414d78
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=6 / me-prepass=0 / brdo=1 / mixed_ref=1 / me_range=12 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=4 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=10849 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=24000 / vbv_bufsize=9000 / ip_ratio=1.10 / pb_ratio=1.10 / aq=2:1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2h 1mn
Bit rate mode                            : Constant
Bit rate                                 : 640 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 555 MiB (5%)
Title                                    : eng
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 2h 1mn
Bit rate mode                            : Constant
Bit rate                                 : 1 510 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 1.28 GiB (12%)
Title                                    : ger
Language                                 : German
Default                                  : Yes
Forced                                   : No
</code></pre>

<p>Moving to another location does not fix the error.</p>

CC BY-SA 3.0
2016-03-08T02:46:54.533Z
How can we reproduce the issue?
llogan
CC BY-SA 3.0
2016-03-08T07:15:43.760Z
By using one of my defect files (as far as I know at the moment). Is there another way to produce that error?
arc_lupus
CC BY-SA 3.0
2016-03-08T17:26:49.443Z
You didn't actually show the exact error, so I'm not sure what the error is. Can you provide a short sample input file?
llogan
CC BY-SA 3.0
2016-03-09T21:54:49.033Z
I added the error, should I just cut the sample with the error out of the full file? If yes, which program can be used for that?
arc_lupus
CC BY-SA 3.0
2016-03-11T01:49:59.520Z
You need to show the complete console output, not just an excerpt. I don't know what video format is contained in your file, so cutting it with `dd` may result in a (even more) broken file, or it may work.
llogan
CC BY-SA 3.0
2016-03-11T09:27:40.950Z
@LordNeckbeard: That is the whole console output I get, nothing more.
arc_lupus
CC BY-SA 3.0
2016-03-11T10:51:37.990Z
Why is the `2` there at the end? If it's for `stderr`, you aren't redirecting it anywhere.
Gyan
<ffmpeg>
Repairing videos producing reading errors
arc_lupus
# Repairing videos producing reading errors

(Asked by: username_0 on 2016-03-07)

I have several videos which produce reading errors in ffmpeg, thus hindering me to play them in VLC (for example). Is there a way to either skip those problematic parts, or to fix them?
The exact error is:
[matroska,webm @ 0x3a13a20] Read error at pos. 11794050343 (0x2befaed27)
[NULL @ 0x3a18380] Unable to find a suitable output format for '2'
2: Invalid argument

generated by the command ffmpeg -v error -i "sample.mkv" -map 0:1 -f null - 2
The video itself has the following encoding (by mediainfo):
Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2h 1mn
Bit rate                                 : 10.8 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 040 pixels
Display aspect ratio                     : 1.85:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.227
Stream size                              : 8.95 GiB (81%)
Writing library                          : x264 core 59 r819M 0414d78
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=6 / me-prepass=0 / brdo=1 / mixed_ref=1 / me_range=12 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=4 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=10849 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=24000 / vbv_bufsize=9000 / ip_ratio=1.10 / pb_ratio=1.10 / aq=2:1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2h 1mn
Bit rate mode                            : Constant
Bit rate                                 : 640 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 555 MiB (5%)
Title                                    : eng
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 2h 1mn
Bit rate mode                            : Constant
Bit rate                                 : 1 510 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 1.28 GiB (12%)
Title                                    : ger
Language                                 : German
Default                                  : Yes
Forced                                   : No

Moving to another location does not fix the error.

**Tags:** ffmpeg

> **Comments:**
> **username_1**: How can we reproduce the issue?  
> **username_0**: By using one of my defect files (as far as I know at the moment). Is there another way to produce that error?  
> **username_1**: You didn't actually show the exact error, so I'm not sure what the error is. Can you provide a short sample input file?  
> **username_0**: I added the error, should I just cut the sample with the error out of the full file? If yes, which program can be used for that?  
> **username_1**: You need to show the complete console output, not just an excerpt. I don't know what video format is contained in your file, so cutting it with `dd` may result in a (even more) broken file, or it may work.  
> **username_0**: @LordNeckbeard: That is the whole console output I get, nothing more.  
> **username_2**: Why is the `2` there at the end? If it's for `stderr`, you aren't redirecting it anywhere.  

---

## 2 answers

### Answer by username_3 on 2016-03-10. Score: 2

I would determine if this is a corrupt file or a corrupt disk. A "read error" sounds like a bad disk to me. If that is the case you probably have bigger problems than reading that video file. I would suggest doing a complete backup of the disk. You can use dd\_rescue (or ddrescue) for that purpose which doesn't stop on bad sectors but makes a copy of everything readable on the disk. Once you have got that done, you can take care of the video file on the backup disk.

<http://www.garloff.de/kurt/linux/ddrescue/>
<https://www.gnu.org/software/ddrescue/>

If the disk is on the verge of failing, the worst you can do is continuing to use it since it may stop working completely anytime soon.

> **Comments:**
> **username_0**: I checked the disk using `badblocks`, and it showed no errors, thus I assume that the disk is still ok. How can I fix the corrupt file then?  
> **username_3**: did you check SMART results as well? See this thread: https://lime-technology.com/forum/index.php?PHPSESSID=4759db970e485a7c450a3dfd7e41ed9d&amp;amp;topic=23792.0  
> **username_3**: If you are positive there is no read errors on the disk, I'd try to make a copy of the file and see how that copy behaves in VLC.  
> **username_0**: Unfortunately the external hard disk does not support SMART, at least according to `gnome-disks`  
> **username_0**: The copy does not behave differently, it still freezes at the same point  
> **username_3**: But unless I missed something, that means your disk has read errors. If you don't care about making a backup of the entire disk, try to use dd_rescue or ddrescue on that file only.  
> **username_0**: Is there a way to test the disk (non-destructively) if there are read-errors except with `badblocks` which did not report any errors?  
> **username_3**: I guess you cannot read out the SMART stats because the disk is in an external enclosure? If so, you could take out the disk from the enclosure and connect it internally to your computer. Unless the drive is older than 10years or so, I would assume it has smart internally but you cannot access it?  
> **username_0**: The disk itself reports that it is unable to use SMART, but that could also be related to the USB connection. I will try that at a second computer.  

---

### Answer by username_4 on 2017-07-28. Score: 0

I've recently had some success with this problem. In my case I was receiving the error converting from MKV to MP4. The cause of the issue was that the process that created the MKV file failed silently when I ran out of disk space so the source feed to ffmpeg was already corrupt; the error was indicating there was no data to convert beyond that point in the source.

Fortunately I was able to recreate the MKV from it's source (after freeing up disk space of course).

Further, as mentioned in Mulvya's comment on your question, the "2" here seems to be what the command is complaining about.


---

