incorrect video

Steam recording with RTMPDump or FFmpeg.
Post Reply
nickomaru
Posts: 1
Joined: Wed Sep 27, 2017 7:52 am

incorrect video

Post by nickomaru » Wed Sep 27, 2017 7:59 am

Hi
i have a file with incorrect video

Ffmpeg (win64) not show this video
Image
But Tsdoctor show this correct
Image
Image

Sample video is here
https://yadi.sk/d/b-HJxW0f3NFhA9

who can help?


Thanks!

navilor
Posts: 44
Joined: Thu May 12, 2011 5:19 pm

Re: incorrect video

Post by navilor » Sun Nov 05, 2017 9:41 pm

You made the mistake of trusting your source content. FFmpeg cannot convert both the video track and the audio track at the same time for this piece of content. Your content is extremely broken likely due to UDP packet loss between the source and capture. I have never seen content this broken in my nine years in the streaming media industry.

Code: Select all

ffmpeg -i Sample_bad_video.ts -codec libx264 -crf 23 -preset veryfast -profile baseline -an -f mp4 -y out-video.mp4

Code: Select all

ffmpeg -i Sample_bad_video.ts -vn -codec aac -b:a 64k -ac 1 -ar 44100  -f mp4 -y out-audio.mp4
When you run those command lines take a look at the colorful test that is going by. Yellow text is a warning. Red text is an error.

Code: Select all

ffmpeg -i out-video.mp4 -i out-audio.mp4 -codec copy -f mp4 outtest.mp4
Note that your incoming content is interlaced and output content should be deinterlaced for web based playback. An example of how to encode content properly is as follows, but you will need to change your frame rate, GoP value, and bitrates accordingly

Pass 1:

Code: Select all

ffmpeg -i inputfile.mp4 -pix_fmt yuv420p -vsync 1 -vcodec libx264 -r 23.976 -threads 0 -b:v: 1024k -bufsize 1216k -maxrate 1280k -preset medium -profile:v high -tune film -g 48 -x264opts no-scenecut -acodec aac -b:a 192k -ac 2 -ar 44100 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -pass 1 -f mp4 -y outputfile.mp4
Pass 2:

Code: Select all

ffmpeg -i inputfile.mp4 -pix_fmt yuv420p -vsync 1 -vcodec libx264 -r 23.976 -threads 0 -b:v: 1024k -bufsize 1216k -maxrate 1280k -preset medium -profile:v high -tune film -g 48 -x264opts no-scenecut -acodec aac -b:a 192k -ac 2 -ar 44100 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -pass 2 -f mp4 -y outputfile.mp4
Force the output frame rate using the "-r" parameter.
https://ffmpeg.org/ffmpeg.html#Description

Vsync parameter for FFmpeg.
https://ffmpeg.org/ffmpeg.html#Advanced-options

The -g option is described below.
https://sites.google.com/site/linuxenco ... eg-mapping

The articles below have several recommendations on bitrate.
https://support.google.com/youtube/answer/1722171?hl=en
https://www.wowza.com/docs/how-to-encod ... d#vbitrate

I have an article on how to calculate a better bitrate.
https://videoblerg.wordpress.com/2015/1 ... -encoding/

The article above is featured in an article by Jan Ozer. It is also referenced in his book Video Encoding by the Numbers in Chapter 7: Choosing Data Rate.
https://streaminglearningcenter.com/blo ... where.html

Please note that both the first pass and the second pass are identical sans the portion that identifies which pass is being used.
https://trac.ffmpeg.org/wiki/Encode/H.264

Audio references can be found below.

aresample:
https://ffmpeg.org/ffmpeg-filters.html#aresample-1

async, min_hard_comp, and first_pts:
https://ffmpeg.org/ffmpeg-resampler.htm ... er-Options

x264 tuning values.
https://superuser.com/questions/564402/ ... -x264-tune

If you have additional questions regarding the command lines above, please reference the FFmpeg documentation.

There is no method to detect broken input like what you have. Never trust your source content.

Post Reply