Opened 4 years ago

Closed 4 years ago

#2379 closed defect (invalid)

FFmpeg produces broken h264 output.

Reported by: dodgexander Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: When I use FFmpeg to re-encode a wtv recording, the result with some of my recordings is an output that is broken, with skipping frames and broken playback. Have tested on multiple players, sometimes it is more obvious than not.

How to reproduce:

--> ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
-->   built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
-->   configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect
-->   libavutil      52. 12.100 / 52. 12.100
-->   libavcodec     54. 81.100 / 54. 81.100
-->   libavformat    54. 49.102 / 54. 49.102
-->   libavdevice    54.  3.102 / 54.  3.102
-->   libavfilter     3. 29.100 /  3. 29.100
-->   libswscale      2.  1.103 /  2.  1.103
-->   libswresample   0. 17.102 /  0. 17.102
-->   libpostproc    52.  2.100 / 52.  2.100

I hope you can help me, because I tried to replicate the steps without using MCEBuddy, but had no luck.

Attachments (3)

skippingoutput.zip (364.7 KB) - added by dodgexander 4 years ago.
Log of conversion process
ffmpeg-20130321-012237.log (498.8 KB) - added by dodgexander 4 years ago.
crash.log (1.1 MB) - added by dodgexander 4 years ago.

Download all attachments as: .zip

Change History (56)

Changed 4 years ago by dodgexander

Log of conversion process

comment:1 Changed 4 years ago by dodgexander

http://www.mediafire.com/?3mv49g6ne3kb9

Sample should be available shortly. I am not sure you can repeat with that sample, because the broken parts of the full video appear further in. I will upload a sample of the output also so you can see how it is broken.

If it doesn't reproduce, if I upload a chunk of the file taken further in, will it work?

Last edited 4 years ago by dodgexander (previous) (diff)

comment:2 Changed 4 years ago by dodgexander

  • Summary changed from FFmepeg produces broken h264 output. to FFmpeg produces broken h264 output.

comment:3 Changed 4 years ago by dodgexander

My settings:

-vcodec libx264 -b 7000k -flags +ildct+ilme -x264opts interlaced=true:me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=8:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:level=4.1:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=auto -map 0:a -map 0:v -acodec copy

comment:4 Changed 4 years ago by cehoyos

  • Cc cehoyos removed
  • Component changed from FFmpeg to undetermined
  • Keywords wtv dts pts mmco: unref short failure removed

This ticket has currently several different problems.

Generally, please do not add anybody to CC (except yourself to tickets that you did not create) and please test current git head (or at least a very recent release, currently 1.2) before reporting problems.

In this specific case: Please provide one input sample (not eight) and please provide the command line you used together with the complete, uncut console output.

Is there really software that can read the zip you uploaded? I unfortunately am unable to read it, please either post the console output into the ticket (this is preferred) or attach a txt file. Please do not run a script (or other software that calls ffmpeg) when testing FFmpeg, run the executable directly from your shell.

If you cannot reproduce your problem with FFmpeg (directly) but only using third-party software, please report the bug there, as said before, this bug tracker is only for FFmpeg bugs, there is a mailing list for user support, please see http://ffmpeg.org/contact.html
(You may of course report bugs that are only reproducible with one of the libraries but not ffmpeg - the command line interface - but this is not the case here.)

comment:5 follow-up: Changed 4 years ago by dodgexander

How rude! :( I only added you because you were interested in the other case!

I can't paste the console output because it exceeds the allowed text in the description and I cannot upload the log of the job because it exceeds the attachment limit. You develop ffmpeg, but do not know what a zip file is???

Here is part of the broken output: http://www.mediafire.com/?3mv49g6ne3kb9

And Here is a chunk larger of original further in (if you can't repeat with first chunk): http://www.4shared.com/folder/fx0nRHmq/mediastuff.html

Like I said I don't know how to reproduce the bug with ffmpeg directly (not everyone has skills in how to compile and use ffmpeg, in fact I think the majority don't) , but if you take the time to read the log, you should know better than me what is wrong. Its clearly related to ffmpeg and not MCEBuddy.

And the reason i upload multiple files is to help you repeat the bug. Here ill split the links to make it easier:

100mb sample of source file: http://www.mediafire.com/?hbhha69x4kxubyt
400mb sample of source file http://www.4shared.com/folder/fx0nRHmq/mediastuff.html
Sample of broken outut: http://www.mediafire.com/?pvg6c4x88ejq6lf

Log of conversion process (or you can use 7zip to open attached zip file): http://www.mediafire.com/?vs4n45q184dqm45

comment:6 in reply to: ↑ 5 Changed 4 years ago by cehoyos

Replying to dodgexander:

I can't paste the console output because it exceeds the allowed text in the description and I cannot upload the log of the job because it exceeds the attachment limit.

I have worked on quite a lot of tickets, I do not remember one where the console output did not easily fit into a text file that was not several MB large.

You develop ffmpeg, but do not know what a zip file is???

I do know what a zip file is, unfortunately the text file in the zip is unreadable (as is "skippingoutput.log" which you uploaded to mediafire).

Here is part of the broken output: http://www.mediafire.com/?3mv49g6ne3kb9

This folder now contains ten files: How am I supposed to know which one I should test?

And Here is a chunk larger of original further in (if you can't repeat with first chunk): http://www.4shared.com/folder/fx0nRHmq/mediastuff.html

"No files in this folder"

Like I said I don't know how to reproduce the bug with ffmpeg directly (not everyone has skills in how to compile and use ffmpeg, in fact I think the majority don't) ,

Apart from the fact that it is easy to compile FFmpeg, it is not necessary, please find current builds at http://ffmpeg.zeranoe.com/builds/

but if you take the time to read the log, you should know better than me what is wrong.

As said, the "log" is unfortunately unreadable, so far I don't even know what you are trying to / what you want FFmpeg to do.

Its clearly related to ffmpeg and not MCEBuddy.

In this case it should be simple to provide the failing command line.

And the reason i upload multiple files is to help you repeat the bug. Here ill split the links to make it easier:

100mb sample of source file: http://www.mediafire.com/?hbhha69x4kxubyt

I downloaded skippingoutput.wtv (104857600 bytes, md5sum f181710405f41c7f62cd45461b4538f9)
The file plays fine here with ffplay, I was able to convert it to avi and mov, I remuxed it to mpegts and all three output files play fine with MPlayer.

400mb sample of source file http://www.4shared.com/folder/fx0nRHmq/mediastuff.html

"No files in this folder"

Sample of broken outut: http://www.mediafire.com/?pvg6c4x88ejq6lf

Log of conversion process (or you can use 7zip to open attached zip file): http://www.mediafire.com/?vs4n45q184dqm45

As said, this is not a readable format.

comment:7 follow-up: Changed 4 years ago by dodgexander

The 400mb sample is available now : http://www.4shared.com/folder/fx0nRHmq/mediastuff.html

Not sure why you can't open the the file skippingoutput.log it is just a text file, open it with a text editor.

Here is a link of it saved as .txt file: http://www.mediafire.com/view/?qm56puqftcytlf5

As for the output sample of the conversion process: http://www.mediafire.com/?pvg6c4x88ejq6lf you are unable to playback that file? Because this is an example of how the file is broken after conversion.

Thanks for your help!

Last edited 4 years ago by dodgexander (previous) (diff)

comment:8 Changed 4 years ago by dodgexander

The goal is to produce an unbroken output using these settings:

-vcodec libx264 -b 7000k -flags +ildct+ilme -x264opts interlaced=true:me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=8:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:level=4.1:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=auto -map 0:a -map 0:v -acodec copy

comment:9 in reply to: ↑ 7 Changed 4 years ago by cehoyos

Replying to dodgexander:

Here is a link of it saved as .txt file: http://www.mediafire.com/view/?qm56puqftcytlf5

"Temporarily unavailable."

Please use either http://www.datafilehost.com/ or read http://ffmpeg.org/bugreports.html

And please provide a complete command line not just an excerpt.

comment:10 follow-up: Changed 4 years ago by dodgexander

Not sure why that is happening, sorry. Here is a working link: http://www.datafilehost.com/download-6a5ad762.html

I have managed to work out how to use ffmpeg alone, but with the command:

ffmpeg -report -i largerbrokensample.wtv a.wtv -vcodec libx264 -b:v 7000k -flags +ildct+ilme -x264opts interlaced=true:me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=8:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:level=4.1:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=auto -map 0:a -map 0:v -acodec copy

Which is the command MCEbuddy is using.

How can I make it so I'm following the command the MCEbuddy uses? Because at the moment I get an mpeg2 output rather than h264.

Really appreciate your help here. Log from ffmpeg is attached.

Changed 4 years ago by dodgexander

comment:11 in reply to: ↑ 10 Changed 4 years ago by cehoyos

Replying to dodgexander:

at the moment I get an mpeg2 output rather than h264.

Your command line is:
$ ffmpeg -i largerbrokensample.wtv a.wtv

which asks ffmpeg to encode your input file (largerbrokensample.wtv) to a.wtv with default parameters (which includes codec mpeg2video).

Before testing with libx264, please try to encode using an internal encoder; only if this does not allow to reproduce your problem, test libx264 (but please mention that internal encoders work fine).

comment:12 Changed 4 years ago by dodgexander

Okay, I have a problem.

I can only repeat the problem with the original file, with the 400mb cut I made, the problem with the frames jumping as seen here: http://www.mediafire.com/?pvg6c4x88ejq6lf

Does not show.

Since I cannot repeat the problem without the full file, how can this be fixed?

comment:13 Changed 4 years ago by cehoyos

Why don't you provide the full sample?

comment:14 Changed 4 years ago by dodgexander

The full sample is a 7gb recording, the problematic files are always recordings in HD, so they are always large.

comment:15 Changed 4 years ago by cehoyos

Could you test the following command lines? Are there any problems with the output files?
$ ffmpeg -i input -qscale 2 out.avi
$ ffmpeg -i input -qscale 2 -vcodec mpeg4 -strict -2 out.mov
$ ffmpeg -i input -qscale 2 -ac 2 out.ts

If yes, please provide the failing command line together with the complete, uncut console output (one is sufficient, just mention if the others work or not) and explain what is wrong with the output file.

comment:16 Changed 4 years ago by dodgexander

Okay, this will take me a while to test as it takes a long time for each conversion process. Thanks for your help.

comment:17 Changed 4 years ago by dodgexander

Okay, my first attempt of conversion with ffmpeg (without MCEBuddy) resulted in a crash of ffmpeg. I was using the same settings as I was with MCEBuddy, where ffmpeg didn't crash, but produced a broken file. Attached is my log.

I will now try what you said to see if I get the same result.

Changed 4 years ago by dodgexander

comment:18 follow-up: Changed 4 years ago by dodgexander

Please ignore attached .log file. This is incorrect. Here is a link to the failed job log: http://www.datafilehost.com/download-83368b6d.html

The resulted output does not exhibit the same problem as the output i found using MCEBuddy, despite using same parameters. I could only test so far into the file though (upto when ffmpeg crashed).

I am uploading the full sample to the server now.

ffmpeg -report -i broken.wtv -qscale 2 out.avi - this produces a working file. BUT because the .wtv recording start off progressive and changes later to interlaced. The whole output is flagged as progressive when it is interlaced. I have a suspicion the problem I have is because the program switches between progressive and interlaced and that ffmpeg is not predicting it.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:19 in reply to: ↑ 18 Changed 4 years ago by cehoyos

Replying to dodgexander:

ffmpeg -report -i broken.wtv -qscale 2 out.avi - this produces a working file. BUT because the .wtv recording start off progressive and changes later to interlaced. The whole output is flagged as progressive when it is interlaced. I have a suspicion the problem I have is because the program switches between progressive and interlaced and that ffmpeg is not predicting it.

This is unlikely because FFmpeg ignores the interlaced flag (it is typically set incorrectly on all satellite streams I have ever looked at, so it would be bad if it is not ignored).

Please remove "-report" from your command line and post some information about the crash here, crashes are always important but I cannot reproduce one with the sample you uploaded.

comment:20 Changed 4 years ago by dodgexander

If I remove report, there is no way for me to copy the lengthy output from the command window. There is a limit on how many commands you can copy and paste and I thought you needed the log files?

The source of my files aren't satellite, they are DVB-T2 in the UK. If I want the program to be interlaced, how can I force it? Because almost all my recordings are like this.

Ill need help finding more detail of the crash, I read

If you encounter a crash bug, please provide the gdb output, backtrace and disassembly, and if possible the valgrind output, using the the ffmpeg_g debug binary.

From bug report, but don't understand what backtrace and disassembly mean, also, I do not know how to combine this with my command to correctly report the crash.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:21 Changed 4 years ago by cehoyos

I know that you are unable to provide gdb output, but please provide the crashing command line together with the complete, uncut console output.

comment:22 Changed 4 years ago by dodgexander

ffmpeg -i broken.wtv -qscale 2 -vcodec mpeg4 -strict -2 out.mov This produces a working file too, but like before, the program content is interlaced, but even when deinterlacing is forced ON the video is still interlaced.

I am now trying the last command you suggested.

The command that caused the crash:

ffmpeg -report -i broken.wtv -vcodec libx264 -b 7000k -flags +ildct+ilme -x264opts interlaced=true:me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=8:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:level=4.1:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=auto -map 0:a -map 0:v -acodec copy a.ts

As for the console output, isn't it in the log here: http://www.datafilehost.com/download-83368b6d.html

I don't know how to copy and paste it from the command window because the command window always cuts the output.

From the bug report page : You can use the -report option or define the FFREPORT environment variable (to any value) to get the exact command line and the full verbose console output in a file named ffmpeg-*.log in the current directory. Note that the -report option is recent, it will not help tracking regressions in old revisions.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:23 Changed 4 years ago by cehoyos

Are all options necessary to reproduce the crash or is the following command line sufficient?
$ ffmpeg .i largerbrokensample.wtv -vcodec libx264 -b:v 7000k -an out.ts

comment:24 Changed 4 years ago by dodgexander

I don't know. At the moment I am waiting for the 3rd command you suggested to complete its encoding. Once finished I will test the original command with all options to see if it crashes again and then your command.

This takes time for me, because the encodes take a long time. The crash happened the only time I have tried to convert the file with ffmpeg alone. Originally the problem was a broken output.

comment:25 Changed 4 years ago by cehoyos

Replying to dodgexander:

ffmpeg -i broken.wtv -qscale 2 -vcodec mpeg4 -strict -2 out.mov This produces a working file too, but like before, the program content is interlaced, but even when deinterlacing is forced ON the video is still interlaced.

You can deinterlace the input video with -vf yadif and I suspect you can signal interlaced video with -flags +ildct+ilme (as you do for x264).
I am interested: Which application do you use for deinterlacing that listens to the flag inside the stream?

comment:26 Changed 4 years ago by dodgexander

Sorry the command I gave is wrong, this is the correct one.

ffmpeg -report -i broken.wtv -vcodec libx264 -b 7000k -flags +ildct+ilme -x264opts interlaced=true:me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=8:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:level=4.1:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=auto -map 0:a -map 0:v -acodec copy a.ts

I use LAV filters with madVR. Lav filters is set to interlace:Aggressive and mad vr to deinterlace:force. Makes no difference.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:27 follow-up: Changed 4 years ago by dodgexander

ffmpeg -report -i broken.wtv -qscale 2 -ac 2 out.ts

Doesn't reproduce the shuddering I encountered when using MCEBuddy, otherwise exactly the same as the other 3 files produced.

1- No audio because each conversion process copied over a blank hearing impaired track.
2- I found (since my last update) that the only way to get deinterlacing to work was to set LAV Video to interlacing: FORCED and madVR Rendered to interlacing: TOP FIELD FIRST.

On auto, the file remains interlaced, unlike the original .wtv, which switches fine between the two and the flags are read correctly.

I am now in the process of trying to repeat the crash I had before with the original command. So far, the conversion is going fine with no crashes.

comment:28 in reply to: ↑ 27 Changed 4 years ago by cehoyos

Replying to dodgexander:

ffmpeg -report -i broken.wtv -qscale 2 -ac 2 out.ts

Doesn't reproduce the shuddering I encountered when using MCEBuddy, otherwise exactly the same as the other 3 files produced.

1- No audio because each conversion process copied over a blank hearing impaired track.

Use -map 0:3 -map 0:2

2- I found (since my last update) that the only way to get deinterlacing to work was to set LAV Video to interlacing: FORCED and madVR Rendered to interlacing: TOP FIELD FIRST.

On auto, the file remains interlaced, unlike the original .wtv, which switches fine between the two and the flags are read correctly.

Are you sure that the deinterlacer isn't running all the time?

comment:29 follow-up: Changed 4 years ago by dodgexander

Are you sure that the deinterlacer isn't running all the time?

Well, because of programs changing from Progressive to Interlaced, even for the switch to work correctly with the original .wtv file, LAV has to be set too: Deinterlacing:Aggressive, but this (as far as I know) doesn't always force interlacing on, just detects it more accurately.

Deinterlacing: Forced is what is needed to get deinterlacing to work after ffmpeg processes the file and apart from this, in madVR the field order also has to be changed manually, which doesn't at all in .wtv.

Use -map 0:3 -map 0:2

Is there any documentation that explains what these mapping functions do? I am guessing it means it copies between track 0-3 video and track 0-2 audio, but not sure.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:30 in reply to: ↑ 29 Changed 4 years ago by cehoyos

Replying to dodgexander:

Are you sure that the deinterlacer isn't running all the time?

Well, because of programs changing from Progressive to Interlaced, even for the switch to work correctly with the original .wtv file, LAV has to be set too: Deinterlacing:Aggressive, but this (as far as I know) doesn't always force interlacing on, just detects it more accurately.

I may of course be wrong, but I would be very surprised if this "detection" works, I find it much more likely that your whole stream gets deinterlaced.

Use -map 0:3 -map 0:2

Is there any documentation that explains what these mapping functions do?

http://ffmpeg.org/ffmpeg.html#Advanced-options

comment:31 follow-up: Changed 4 years ago by dodgexander

I may of course be wrong, but I would be very surprised if this "detection" works, I find it much more likely that your whole stream gets deinterlaced.

This is what I would have thought too, but there is an aggressive option and a force option. With the converted file, only force works, so I suspect they are different, somehow.

comment:32 in reply to: ↑ 31 Changed 4 years ago by cehoyos

Replying to dodgexander:

I may of course be wrong, but I would be very surprised if this "detection" works, I find it much more likely that your whole stream gets deinterlaced.

This is what I would have thought too, but there is an aggressive option and a force option. With the converted file, only force works, so I suspect they are different, somehow.

Of course: The original file is sent with the interlaced flag (for the whole file); since you (I) did not specify the interlaced option for the transcoding (-flags +ildct+ilme), the output file does not contain the interlaced flag (that has absolutely nothing to do with interlaced *content* but only interlaced encoding which is always used where I live, no matter if the content is interlaced and a deinterlacer is needed or if the content is progressive - the reason is that from a broadcaster's point-of-view, encoding progressive material as interlaced only has a minor overhead while encoding interlaced material as progressive costs a lot of quality).

comment:33 Changed 4 years ago by dodgexander

Okay my 7gb upload failed, I would have thought it was too large to transfer. I can normally resume when that happens, but since it is write only, I can't.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:34 follow-up: Changed 4 years ago by dodgexander

I can't even repeat the problem with ffmpeg using the same source file (complete).

This is despite using the same settings to convert with mcebuddy and ffmpeg, I do not know what to do now :(

And despite using same settings, the output files created are different.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:35 in reply to: ↑ 34 Changed 4 years ago by cehoyos

Replying to dodgexander:

I can't even repeat the problem with ffmpeg using the same source file (complete).

Do you mean that with the same ffmpeg binary and the same input file and the same options, the problem is sometimes reproducible and sometimes not reproucible?

comment:36 Changed 4 years ago by dodgexander

No, I have only tried to repeat the problem once with Ffmpeg.

But using the same options as MCEBuddy, the problem isn't repeatable.

I opened a ticket with Rami over at the MCEBuddy tracker. He think I missed some steps in the conversion progress that MCEBuddy uses that I didn't place in my FFMPEG command to repeat it. But using the log from MCEBuddy, I cannot find what is different.

comment:37 Changed 4 years ago by dodgexander

Please just close this, going to start a fresh once I can find a better sample. Thanks for your help.

comment:38 Changed 4 years ago by cehoyos

Did you find out what the problem was that you cannot reproduce anymore?

comment:39 follow-up: Changed 4 years ago by dodgexander

Yes,I think, but not sure yet the problem with the stuttering/juddering frames was not using libx264, but instead the copy encoder.

I have opened a ticket on MCEBuddy's tracker about it and I will try repeat the bug using ffmpeg directly too. Once I can repeat the problem ill open a new ticket on here if needed, try to make it clearer that way.

The only remaining problems I have after this are:

https://ffmpeg.org/trac/ffmpeg/ticket/2220

av_interleaved_write_frame(): Invalid argument

<---- Preventing me from using the copy encoder with some h264 .wtv recordings.

https://ffmpeg.org/trac/ffmpeg/ticket/2227

<---- And another case you are involved in, this case is stopping me from using the copy encoder on a lot of mpeg2 .wtv files using MCEBuddy. They remux, remux again and remux a third time, I guess because as ramit explains, the detection by ffmpeg seems to conflict with other applications.

If you're interested, you can take a look at my case open on the MCEBuddy tracker related to this: http://mcebuddy2x.codeplex.com/workitem/1478

Thanks for your time and sorry for getting my information mixed up. These kind of problems are a whole new level to me.

comment:40 in reply to: ↑ 39 Changed 4 years ago by cehoyos

Replying to dodgexander:

The only remaining problems I have after this are:

https://ffmpeg.org/trac/ffmpeg/ticket/2220

av_interleaved_write_frame(): Invalid argument

Could you try if "-ss 1" fixes all these files?

<---- Preventing me from using the copy encoder with some h264 .wtv recordings.

https://ffmpeg.org/trac/ffmpeg/ticket/2227

<---- And another case you are involved in, this case is stopping me from using the copy encoder on a lot of mpeg2 .wtv files using MCEBuddy.

Remuxing works fine for me with the sample from ticket #2227.

Version 0, edited 4 years ago by cehoyos (next)

comment:41 follow-up: Changed 4 years ago by dodgexander

Could you try if "-ss 1" fixes all these files?

The following works yes. But only if I place the -ss 1 before the input file.

ffmpeg -report -ss 1 -i broken.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -f mpegts ss1test.ts

Remuxing works fine for me with the sample from ticket #2227

It might do using ffmpeg alone, but it doesn't in MCEBuddy because of the mjpeg being passed as a video stream. Because of this and according to ramit. It messes up the process and thats why MCEBuddy has to recode about 3 times for it to work.

I am guessing to use ffmpeg with 3rd party tools (comskip, or a tool to remove particular audio tracks for example), ffmpeg is used to identify each stream. Since it identifies an image as a video, other tools then look at this image as a video and it causes them to error out. (this is speculative, I do not know the ins and out of how MCEBuddy works.

comment:42 in reply to: ↑ 41 Changed 4 years ago by cehoyos

Replying to dodgexander:

Remuxing works fine for me with the sample from ticket #2227

It might do using ffmpeg alone, but it doesn't in MCEBuddy

I hope this explains the cause of the problem you have with that file...

comment:43 Changed 4 years ago by dodgexander

So what about needing the -ss 1 argument for the files I have that don't copy remux without it?

Is this something to be fixed in the future?

comment:44 Changed 4 years ago by cehoyos

Sorry, but if you really believe I know what the future brings, you greatly overestimate me...

comment:45 Changed 4 years ago by cehoyos

Is there still something that can be fixed about this ticket or can I close it? I am still curious why the problem happens sometimes but not always for you but if you cannot explain this, I probably can't either.

comment:46 Changed 4 years ago by dodgexander

Could you try if "-ss 1" fixes all these files?

You said it yourself. -ss 1 fixes the ones that have this error.

Its not intermittent when you find a source file, no matter how many times you feed it:

ffmpeg -i input.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -f mpegts output.ts

It presents:

av_interleaved_write_frame(): Invalid argument

If you use:

ffmpeg -ss 1 -i input.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -f mpegts output.ts

It works

---

So why the -ss 1, why doesn't it work without this? Since you can see the problem in my logs, why is this not recognised as a bug and been flagged to be fixed?

Now this is roughly 30% of my h264 .wtv recordings. So if you need anything more to reproduce the file and fix it, let me know.

Last edited 4 years ago by dodgexander (previous) (diff)

comment:47 Changed 4 years ago by cehoyos

Isn't this ticket #2220 you are referring to?

comment:48 Changed 4 years ago by dodgexander

Yes, this is a ticket Ramit opened,I think I also linked it in the other ticket.

Surely if you know that -ss 1 fixes, it can be investigated? :)

comment:49 Changed 4 years ago by cehoyos

Allow me to repeat that I'd still like to understand why - if I understood one of your posts above correctly - ffmpeg sometimes works and sometimes fails for the same input file.

If you can reproduce this behaviour (this different behaviour), could you post the command lines together with console output both for the working and the non-working case?

comment:50 Changed 4 years ago by dodgexander

Allow me to repeat that I'd still like to understand why - if I understood one of your posts above correctly - ffmpeg sometimes works and sometimes fails for the same input file.

No.Your impression is incorrect. It happens all the time with certain files and I can repeat the problem.

If you can reproduce this behaviour (this different behaviour), could you post the command lines together with console output both for the working and the non-working case?

Not working:

ffmpeg -i input.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -f mpegts output.ts
O:\ffmpegtest>ffmpeg -i broken.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -
f mpegts broken.ts
ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/
home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mi
ngw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-lib
rtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpe
g --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-fr
ei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxav
s --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --
enable-libvpx --enable-runtime-cpudetect
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[aac_latm @ 0039f820] initializing latmctx
[aac_latm @ 0039ec40] initializing latmctx
[h264 @ 0039f220] mmco: unref short failure
    Last message repeated 2 times
Input #0, wtv, from 'broken.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : The Graham Norton Show
    WM/SubTitleDescription: The award-winning host continues his talk show. Grah
am is joined by Sherlock Holmes star Jude Law, Ted and Family Guy actress Mila K
unis, Spiderman and 127 Hours star James Franco, and the legendary Dame Judi Den
ch. With music from Olly Murs.
    genre           : Shows;Talk Show
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Steve Smith;Graham Norton;
    service_provider: BBC One HD
    service_name    : BBC One HD
    WM/MediaOriginalChannel: 101
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-03-01T00:00:00Z
    WM/MediaOriginalRunTime: 29912779688
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: false
    WM/WMRVEncodeTime: 2013-03-01 22:33:08
    WM/WMRVSeriesUID: !GenericSeries!The Graham Norton Show
    WM/WMRVServiceID: !MCService!759242
    WM/WMRVProgramID: !MCProgram!49925152
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 29918791257
    WM/WMRVEndTime  : 2013-03-01 23:23:00
    WM/WMRVBitrate  : 8.018846
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 411
    WM/WMRVActualSoftPostPadding: 180
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 352
    WM/MediaThumbHeight: 198
    WM/MediaThumbStride: 1056
    WM/MediaThumbRet: 0
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 0
    WM/MediaThumbAspectRatioX: 1920
    WM/MediaThumbAspectRatioY: 1080
    WM/MediaThumbTimeStamp: -4616189618054758400
    WM/MediaThumbType: 2
  Duration: 00:49:50.88, start: 1.659108, bitrate: 8021 kb/s
    Stream #0:0[0x77](eng): Subtitle: dvb_subtitle
    Stream #0:1[0x78](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz,
stereo, fltp (hearing impaired)
    Stream #0:2[0x79]: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9]
, 25 fps, 25 tbr, 10000k tbn, 50 tbc
    Stream #0:3[0x7a](eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz,
5.1, fltp
    Stream #0:4[0x0]: Attachment: mjpeg
    Metadata:
      title           : TV Thumbnail
Output #0, mpegts, to 'broken.ts':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : The Graham Norton Show
    WM/SubTitleDescription: The award-winning host continues his talk show. Grah
am is joined by Sherlock Holmes star Jude Law, Ted and Family Guy actress Mila K
unis, Spiderman and 127 Hours star James Franco, and the legendary Dame Judi Den
ch. With music from Olly Murs.
    genre           : Shows;Talk Show
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : ;Steve Smith;Graham Norton;
    service_provider: BBC One HD
    service_name    : BBC One HD
    WM/MediaOriginalChannel: 101
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2013-03-01T00:00:00Z
    WM/MediaOriginalRunTime: 29912779688
    WM/MediaIsStereo: false
    WM/MediaIsRepeat: false
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: true
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: false
    WM/WMRVEncodeTime: 2013-03-01 22:33:08
    WM/WMRVSeriesUID: !GenericSeries!The Graham Norton Show
    WM/WMRVServiceID: !MCService!759242
    WM/WMRVProgramID: !MCProgram!49925152
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 0
    WM/WMRVOriginalSoftPrePadding: 420
    WM/WMRVOriginalSoftPostPadding: 180
    WM/WMRVHardPrePadding: -300
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: true
    WM/WMRVHDContent: true
    Duration        : 29918791257
    WM/WMRVEndTime  : 2013-03-01 23:23:00
    WM/WMRVBitrate  : 8.018846
    WM/WMRVKeepUntil: -1
    WM/WMRVActualSoftPrePadding: 411
    WM/WMRVActualSoftPostPadding: 180
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    WM/MediaThumbWidth: 352
    WM/MediaThumbHeight: 198
    WM/MediaThumbStride: 1056
    WM/MediaThumbRet: 0
    WM/MediaThumbRatingSystem: 255
    WM/MediaThumbRatingLevel: 255
    WM/MediaThumbRatingAttributes: 0
    WM/MediaThumbAspectRatioX: 1920
    WM/MediaThumbAspectRatioY: 1080
    WM/MediaThumbTimeStamp: -4616189618054758400
    WM/MediaThumbType: 2
    encoder         : Lavf54.49.102
    Stream #0:0(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, stereo
 (hearing impaired)
    Stream #0:1(eng): Audio: aac_latm ([2][22][0][0] / 0x1602), 48000 Hz, 5.1
    Stream #0:2: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25
fps, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:3 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mpegts @ 03c607e0] pts (103514) < dts (110714) in stream 2
av_interleaved_write_frame(): Invalid argument

Working:

ffmpeg -ss 1 -i input.wtv -vcodec copy -acodec copy -map 0:a -map 0:v -f mpegts output.ts

Console output: http://www.datafilehost.com/download-8501f315.html (too large to copy and paste from cmd window due to excessive warnings)

Last edited 4 years ago by dodgexander (previous) (diff)

comment:51 Changed 4 years ago by cehoyos

Sorry, but how is this problem (the problem from ticket #2220 about bad initial timestamps) related to this ticket where your wrote in comment:18 that you see a problem when using the third-party application that you cannot reproduce when calling ffmpeg directly with the same options? Or did I misunderstand the original problem here (in this ticket) and it is simply a duplicate of ticket #2220 ?

Last edited 4 years ago by cehoyos (previous) (diff)

comment:52 Changed 4 years ago by dodgexander

It isn't related to this ticket, these are two different problems.

comment:18 is invalid which is why I asked to close this ticket, I was testing the wrong sample file with the wrong problem, my fault for any confusion.

As it stands, the problem I initially opened this ticket for is the same as #2398. Ticket #2398 has the correct sample.

The problem I am talking about now (at the end of the thread) is the same as #2220.

The difference being, unlike shown in #2220 adding -ss 1 to the command fixes the problem, as you recommended above.

Can we close this ticket and add to #2220 that -ss 1 in the command fixes the problem? Because I would like to understand why this is and whether ffmpeg can be fixed in the future so the -ss command is not needed.

comment:53 Changed 4 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.