Hi hi,
I'm working on an iOS app that generates videos and can upload them to Youtube. However, the videos being generated are going corrupt when uploaded to Youtube, and also going corrupt when I try to do anything to them using ffmpeg. I'm trying to learn how to analyse the problem.
The video is 20-seconds long, consisting of some movement/animation, followed by a static image for the last 5 seconds. It's 2.1MB, and it's attached to this post.
The issue seems to be ffmpeg can't handle a video file constructed from multiple concatenated videos. (And by extension, neither can YouTube).
Symptoms:
1. When I play the video on my MacBook Pro (Mountain Lion) using Quicktime Player, it plays correctly -- no corruption.
2. When I upload the mp4 to YouTube, the first part of the video (the part with animation) becomes a solid colour across the entire frame (switches between green, dark green, and grey). The final 5 seconds of the video (the final concatenated video) displays correctly.
3. When I try converting the video from mp4 to mp4, using ffmpeg, it corrupts in exactly the same way as it does when uploaded to Youtube.
ffmpeg command:
$ ffmpeg -i story_0_published.mp4 -acodec copy output.mp4
4. When I try converting the video from mp4 to mov, using ffmpeg, it corrupts in a different way -- rainbow colours instead of solid colours -- but the last 5 seconds still converts correctly.
ffmpeg command:
ffmpeg -i story_0_published.mp4 -acodec copy -vcodec copy -f mov output.mov
Here's the output from ffmpeg. I'm guessing that the "multiple edit list" warning is my main problem, but what is the "top block unavailable" error? Is this a separate issue?
$ ffmpeg -i story_0_published.mp4 -acodec copy -vcodec copy output.mp4
ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 13 2014 12:11:26 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fae98806600] multiple edit list entries, a/v desync might occur, patch welcome
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fae98806600] Concatenated H.264 or H.265 might not play correctly.
Last message repeated 1 times
[h264 @ 0x7fae98836000] top block unavailable for requested intra4x4 mode -1 at 3 0
[h264 @ 0x7fae98836000] error while decoding MB 3 0, bytestream (6090)
[h264 @ 0x7fae98836000] concealing 2304 DC, 2304 AC, 2304 MV errors in I frame
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'story_0_published.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2014-02-11 04:34:39
Duration: 00:00:20.32, start: 0.000000, bitrate: 847 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1024x576 [SAR 1:1 DAR 16:9], 708 kb/s, 20.56 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2014-02-11 04:34:39
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 166 kb/s (default)
Metadata:
creation_time : 2014-02-11 04:34:39
handler_name : Core Media Audio
In case it's useful, I also ran mediainfo on my source video file, but again I don't really know what to look at in here to analyse:
$ mediainfo story_0_published.mp4
General
Complete name : story_0_published.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 2.05 MiB
Duration : 20s 318ms
Overall bit rate : 848 Kbps
Encoded date : UTC 2014-02-11 04:34:39
Tagged date : UTC 2014-02-11 04:34:39
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 20s 318ms
Source duration : 21s 203ms
Bit rate : 742 Kbps
Nominal bit rate : 1 000 Kbps
Width : 1 920 pixels
Height : 1 072 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 20.563 fps
Minimum frame rate : 8.333 fps
Maximum frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.018
Stream size : 1.79 MiB (87%)
Source stream size : 1.79 MiB (87%)
Title : Core Media Video
Writing library : x264 core 130 r2273 b3065e6
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / 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=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=17500 / vbv_bufsize=17500 / nal_hrd=none / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2014-02-11 04:34:39
Tagged date : UTC 2014-02-11 04:34:39
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 16s 602ms
Source duration : 12s 678ms
Bit rate mode : Constant
Nominal bit rate : 256 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Source stream size : 258 KiB (12%)
Title : Core Media Audio
Encoded date : UTC 2014-02-11 04:34:39
Tagged date : UTC 2014-02-11 04:34:39
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
Try StreamFab Downloader and download streaming video from Youtube, Netflix, Amazon! Download free trial.
+ Reply to Thread
Results 1 to 5 of 5
Thread
-
-
How are you concatenating? Because my guess would be that you are taking a shortcut (binary file concat) and that is likely the cause of the problems you are seeing. I have said this a number of times before on this site: proper joining can only be done when care is taken to strip and then correctly rebuild the (now new & aggregated ) headers & metadata.
Also, it ought to go without saying, but keeps needing to (because it is so often foolishly ignored): all elements to be joined must be identical in their format(s), differing only in their lengths & bitrates.
Scott -
Main problem seem to be that lav doesn't support the video, try to playback the content with ffplay and you see a lot of errors.
-> How did you create the file? If you used, like Cornucopia guessed, a simple binary copy you got your problem. (concatenating stuff via binary copy is normally a bad idea) -
iOS movies are long GOP variable frame rate. This is an efficient strategy for creating (relatively) small sized, (relatively) high quality videos that can be shared device to device. It sucks for editing.
As you have discovered, to join files without reencoding allows for playback, sometimes, under only the most specialized of circumstances. You need to edit and reencode to make the files useful.
On a mac your choices are FCPX, iMovie or Premiere. On a PC almost any NLE will work. Yes, you will lose quality, but the alternative is a useless file. -
Concatenation is being done using AVMutableComposition and AVVideoExport (iOS classes).
Progress. We've now discovered that the first and last videos (which were generated on a desktop, not by the app) were causing the video to be corrupted. These two videos are just a single frame played for 5 seconds (intro & outro components). So now we just need to track down what's causing those to dislike the rest of the video segments (maybe they are in mismatched formats or codecs, like you say Cornucopia). And potentially generate new videos of those static frames with some ffmpeg magic.
I'll try diffing the output of mediainfo from the different video segments and see if there's any obvious differences.
Similar Threads
-
Fixing corrupt MP4 video recovered from SD card
By phonicx in forum Newbie / General discussionsReplies: 16Last Post: 14th Jun 2021, 01:43 -
Video Uploaded on Youtube Plays Too Fast
By selectivesloth in forum Video Streaming DownloadingReplies: 95Last Post: 10th Oct 2012, 09:10 -
Help with Corrupt mp4 video files. from Sanyo WH-1
By Jmiller0921 in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 2Last Post: 31st Mar 2010, 22:27 -
My recently uploaded video on YouTube has no video, only audio?
By Nintendo Fan in forum Video Streaming DownloadingReplies: 14Last Post: 17th Apr 2009, 17:15 -
How to copy back videos uploaded to youtube?
By come_mon in forum Video Streaming DownloadingReplies: 7Last Post: 16th Mar 2009, 15:47