microsoft / FFmpegInterop

This is a code sample to make it easier to use FFmpeg in Windows applications.
Apache License 2.0
1.3k stars 310 forks source link

When we need to force AudioDecode or VideoDecode? #36

Open WinPhoneDev opened 9 years ago

WinPhoneDev commented 9 years ago

Hi, I was trying to use FFMpegInterop in windows phone 8.1, everything works fine, but in some of videos needs forceAudioDecode to be true (because when I put false in parameter, audio is spoiled)

In videos that didn't need to force AudioDecode to be true, when I true the audio decoding, audio + video playing its very fast, looks like player is in fast forward mode!

With pot player for Windows I found this: for video that didn't need to force Audio decoding to be true:

General Unique ID : 60079824637526059836669318900286688400 (0x2D32F40D95D34A41DF13E6E9647B0C90) Complete name : C:\Users\admin\Downloads\Video\Dark.Matter.S01E06.480p.mkv Format : Matroska Format version : Version 4 / Version 2 File size : 150 MiB Duration : 42mn 57s Overall bit rate : 488 Kbps Movie name : Dark Matter S01E06 - RMTeam Writing application : Lavf56.40.101 Writing library : Lavf56.40.101 DESCRIPTION : Encoded By RMTeam

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3.1 Format settings, CABAC : Yes Format settings, ReFrames : 4 frames Codec ID : V_MPEG4/ISO/AVC Width : 854 pixels Height : 480 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Writing library : x264 core 146 r109 121396c Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=24.5 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=10000 / vbv_bufsize=10000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Language : English Default : Yes Forced : No

Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : A_AAC Duration : 42mn 57s Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Writing library : Lavc56.49.101 aac Default : Yes Forced : No

and a video that need force Audio decoding to true: General Unique ID : 184677726890362367291245475020848181446 (0x8AEFA2ECF136B19B988E4E2442EF30C6) Complete name : C:\Users\admin\Downloads\Video\Inside.Out.2015.720p.HDRip.mkv Format : Matroska Format version : Version 4 / Version 2 File size : 702 MiB Duration : 1h 34mn Overall bit rate : 1 038 Kbps Movie name : Inside Out Encoded date : UTC 2015-09-28 20:01:12 Writing application : mkvmerge v8.3.0 ('Over the Horizon') 64bit Writing library : libebml v1.3.1 + libmatroska v1.4.2 DURATION : 00:58:26.057000000 NUMBER_OF_FRAMES : 3 NUMBER_OF_BYTES : 276 _STATISTICS_WRITING_APP : mkvmerge v8.3.0 ('Over the Horizon') 64bit _STATISTICS_WRITING_DATE_UTC : 2015-09-28 20:01:12 _STATISTICS_TAGS : BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings, CABAC : Yes Format settings, ReFrames : 5 frames Codec ID : V_MPEG4/ISO/AVC Duration : 1h 34mn Nominal bit rate : 972 Kbps Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 30.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.035 Writing library : x264 core 146 r2538 121396c Encoding settings : cabac=1 / ref=5 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=972 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=62500 / vbv_bufsize=78125 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Default : Yes Forced : No

Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : HE-AAC / LC Codec ID : A_AAC Duration : 1h 34mn Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz / 24.0 KHz Compression mode : Lossy Delay relative to video : 31ms Default : Yes Forced : No

so When we need to force AudioDecode ? How can I programmatically know when I need to force Audio decoding to true?

thanks

timotiusmargo commented 9 years ago

It looks like the media foundation does not handle certain compressed AAC format as is. Maybe we need to specify extra information in AudioStreamDescriptor for it to play well. For the time being, can you have the sample media files somewhere that can be shared for testing?

WinPhoneDev commented 9 years ago

OK, here: video that didn't need to force Audio decoding to be true: http://www.uploadbaz.com/8dy0i78giram

video that need force Audio decoding to true: http://dl.par30dl.com/Animation/36/Inside.Out.2015.720p.HDRip_www.par30dl.com.mkv