59
TRANSCODING for ACCESS and PRESERVATION Screening the Future Skip Elsheimer, A/V Geeks Dave Rice, AV Preserve 2011-03-15

Introduction to Transcoding: Tools and Processes

Embed Size (px)

DESCRIPTION

 

Citation preview

TRANSCODING forACCESSand

PRESERVATION

Screening the FutureSkip Elsheimer, A/V GeeksDave Rice, AV Preserve

2011-03-15

Our Approach Grass-roots digitizing - little to no budgets. Low cost digitizing stations. Open source software tools Off the shelf computer hardware Transparent and controllable tools

Who are these guys anyway?

David Rice

Skip Elsheimer

OUTLINE OF PRESENTATION

intro of digital videowhy transcode?

transcoding assembly linetranscoding for access

transcoding for preservation

TranscodingWhat is it?

Transcoding is the direct digital-to-digital conversion of one video encoding format to another.

Why do it?Access... The Preservation Master is too big of a file to share with

researchers. Can't be streamed online. Can't be easily edited with popular NLE software. Can't play in a DVD player. In a codec that can't be played back in real time or is

proprietary. The “popular” online access format keeps changing

(Realmedia, WMW, FLV, MPEG4, WebM?) as does the bandwidth allowed.

Why do it?Migration...

Moving to a new, more efficient codec. Moving to an archive-wide standard codec. Original file codec that can't be played back in real time

or is no longer being supported by current video playing software.

Characteristics of a Pixel & Frame

• Number of Channels/Samples (1, 2, 3, or 4)

• Colorspace (gray, RGB, YUV, XYZ, etc)

• Bit Depth (1, 4, 8, 10, 16)

• Valid Pixel Values ( 0-255, 16-235/16-240)

• Pixel Aspect Ratio

• Pixel Height and Pixel Width (640x480)

• Chroma Subsampling

• Packed or Paletted

• Interlaced or Progressive

• Presentation Time / Frame Duration

Y Cb / Cr

Colorspace

Transcoding Process

•Demultiplexion

•Decoding

•Filters: Conversion of Pixel Format, Scaling, Padding, Cropping, Denoise, Inverse Telecine, Image Processing

•Encoding

•Multiplexion

•Open MXF

•Decode jpeg2000 to raw video

•scale to 640x480, denoise, deinterlace filter, overlay logo, change pixel format from YUV 4:2:2 to YUV 4:2:0

•Encode to h264

•Wrap in MP4

Transcoding Process

Transcoding ProcessDV NTSC to DV PAL

< File size : 36000000> File size : 36144000< Duration : 00:00:10.010> Duration : 00:00:10.040< Height : 480> Height : 576< Pixel aspect ratio : 0.889> Pixel aspect ratio : 1.067< Frame rate : 29.970> Frame rate : 25.000< Frame count : 300> Frame count : 251< Chroma subsampling : 4:1:1> Chroma subsampling : 4:2:0

Transcoding ProcessFilm to Betacam

< Size : Large and round> Size : Small and rectangular< Frame Size : ~8k> Frame Size : 720x486< Frame rate : ~24.000> Frame rate : 29.970< Chroma subsampling : none> Chroma subsampling : 4:2:2

< Colorspace : RGB?> Colorspace : YUV

< Interlacement : None (Progressive)> Interlacement : Interlaced

Digital video basics - here’s what can be manipulated/lost/mangled when you transcode a video file

Much transcoding for access is to reduce the bandwidth of the file and to switch to a more popularly available codec. Example – going from JPEG2000 MXF file to 800kbps h264 file.

Reduce the frame size of the video file (720x540 to 320x240).

Compress intraframe (each frame like JPEG) and intraframe (reduce number of frames, like MPEG)

Change the color space and sampling rate (RGB to YUV, 10bit to 8bit).

Deinterlacing, denoising for better encoding. Aspect ratio. Don't crop or squeeze an SD frame into a

HD frame. Pad with pillarboxes.

Why is transcoding for access important and you should give it more attention in yourworkflow?

To most people, an access file is a preservation file. Without giving access, you are “shelving for the future”

and not “screening for the future”. Going from an arcane format (tape/film) on a shelf to an arcane digital file on a hard drive on a shelf.

Brewster Kahle's 3 points of access for future generations. PrestoPRIME “Preservation for access”

Access can give context to the archive and generate interest(funding) to do further digitizing.

Examples of transcoding for access Make a reference DVD for average viewer. Make a stream-friendly file - h264. Make a file that can easily ingested for broadcast

purposes. Updating online access file as average audience

bandwidth increases, target screen changes (from computer to ipod to ipad to...), codec dujoir changes (Realmedia, WMV, MPG4, WebM)

100816 MPEG-4 68580 Windows Media 61985 AVI 49879 RealMedia 43106 JPEG 32318 Flash Video 28937 MPEG Audio 28617 MPEG-PS 13300 QuickTime 5979 OGG 4057 GIF 3365 ShockWave 2940 MPEG Video 1411 DivX 914 Matroska 907 PNG 582 ZIP 480 DV

421 BDAV393 MPEG-TS364 WebM300 SubRip296 Wave191 AMR189 ADTS117 DVD Video113 GZip 66 Bitmap 65 MZ 57 AIFF 56 7-Zip 49 MXF 38 FLAC 31 AC-3 27 CDXA/MPEG-PS

A/V Container Popularity (# by use)within Internet Archive original video uploads

81625 MPEG-4 Visual68283 AVC43226 VC-133854 RealVideo 420374 H.26320131 MPEG-2 Video16793 VP616021 WMV211907 MPEG-1 Video 9502 M-JPEG 7880 RealVideo 3 6530 Sorenson 3 4865 WMV1 4272 Theora 1376 Dirac1308 DV1131 DVCPRO1063 RLE 938 Sorenson 1 935 Cinepack 594 Indeo 4 577 Road Pizza 508 RGB 422 xvid 364 VP8 335 MS Video 252 WVP2 225 TechSmith 225 RealVideo 2 205 M-PNG

A/V Video Codec Popularity (# by use)within Internet Archive original video uploads

24025 29.97021285 25.00010213 30.000 7265 15.000 2297 23.976 2150 14.985 1370 7.500 954 12.000 813 24.000 748 20.000 723 8.000 568 10.000

516 29.000 466 29.900 368 11.988 359 59.940 291 7.000 225 60.000 206 12.500 167 14.970 120 15.170 119 50.000

Video Frame Rate Popularity (# by use)

3775 720x480 @ 4:32956 720x480 @ 3:2 556 720x480 @ 16:9 13 720x480 @ 1.600 4 720x480 @ 1.296 4 720x480 @ 2.2:1 4 720x480 @ 4.615 3 720x480 @ 2.227 2 720x480 @ 1.636 2 720x480 @ 1.666 1 720x480 @ 1.863 1 720x480 @ 2.35:1

Sampling of the Display Aspect Ratiosof 7,321 videos with 720x480 frame size

Transcoding Use Case:Democracy Now!

DVCamDVCam

miniDVminiDV

CD-RCD-R

.dv.dv

.flac.flac

.mpeg.mpeg

.h264.h264InternInternet et

ArchivArchivee

.mp4.mp4

.mp3.mp3

.ogg.ogg

.mp4.mp4

.ogv.ogv

DVD-RDVD-R

CD-RCD-R

Created during

broadcast

• ffmpeg -i camels.avi -vn -acodec libfaac -ab 64k -ac 2 temp.aac• ffmpeg -an -deinterlace -i camels.avi -s 320x240 -r 20 -vcodec rawvideo -pix_fmt yuv420p -f rawvideo - 2>/dev/null | ffmpeg -an -f rawvideo -s 320x240 -r 20 -i - -f yuv4mpegpipe - 2>/dev/null | x264 --bitrate 512 --vbv-maxrate 768 --vbv-bufsize 1024 --profile baseline --pass 1 /dev/stdin --demuxer y4m -o temp.h264• ffmpeg -an -deinterlace -i camels.avi -s 320x240 -r 20 -vcodec rawvideo -pix_fmt yuv420p -f rawvideo - 2>/dev/null | ffmpeg -an -f rawvideo -s 320x240 -r 20 -i - -f yuv4mpegpipe - 2>/dev/null | x264 --bitrate 512 --vbv-maxrate 768 --vbv-bufsize 1024 --profile baseline --pass 2 /dev/stdin --demuxer y4m -o temp.h264• mp4creator -c temp.h264 -r 20 t2.mp4• mp4creator -c temp.aac -interleave t2.mp4• ffmpeg -i t2.mp4 -acodec copy -vcodec copy -metadata title="Camels at a Zoo - http://www.archive.org/details/camels" -metadata year="2004" -metadata comment="license:http://creativecommons.org/licenses/by-nc/3.0/" camels_512kb.mp4• mp4creator -optimize camels_512kb.mp4

qtmux

qtmux --metadatatype metadata -o out.mov inVideo.mov inAudio.movuse -siv to activate save-in-placemultiple metadatatypes and input videos welcomeaccepted metadatatypes: Album, Artist, Author, Chapter, Comment, Composer, Copyright, CreationDate, Description, Director, Disclaimer, EncodedBy, FullName, Genre, HostComputer, Information, Keywords, Make, Model, OriginalArtist, OriginalFormat, OriginalSource, Performers, Producer, Product, Software, SpecialPlaybackRequirements, Track, Warning, Writer, URLLink, EditDatealso accepted are metadatatypes of 4 characters starting with @

qtmedia

-File- "/Users/daverice/Downloads/B03774-12.mov_bitc.mov"-Info-Hinted: No Ref Movie: No Size: 600.00 x 480.00 Duration: 32.00 seconds DataRate: 90077.97 bytes/secs BitRate: 0 bits/secsUser Data: ©enc: "WITNESS Media Archive oris: "E007653 (WITNESS Media Archive); Prior source: B03774 (WITNESS Media Archive); FCP Reel Value: B03774 cmmt: "Master (Generation). name: "[Screening of ON THE FRONTLINES in Gasorwe, Nuyinga, and Mwaro] (3869) perf: "Bukeni Tete Waruzi genr: "Raw prod: "P-OTF On the Frontlines: Child Soldiers in the DRC. keyw: "Child Soldiers, Film and Video Screenings, WITNESS Events, WITNESS Partners, WITNESS, Burundi, Africa, Gasorwe, Nuyinga, Democratic Republic of Congo (formerly Zaire), Mwaro cprt: "WITNESS/AJEDI-ka

Inspection: http://mediainfo.sourceforge.net/

VideoCount : 1AudioCount : 1TextCount : 11Video_Format_List : AVCVideo_Language_List : enAudio_Format_List : DTSText_Format_List : ASS / ASS / ASS / ASS / ASS / ASS / ASS / ASS / ASS / ASS / ASSText_Language_List : en / fr / es / sv / da / fi / hu / ro / de / cs / slFolderName : /Users/daverice/Projects/samples/samples2FileName : matroska+h264+dca+0x0000+memory-usageFileExtension : mkvFormat : MatroskaFileSize : 262144000Duration : 8437088Duration/String3 : 02:20:37.088OverallBitRate : 248563Encoded_Date : UTC 2007-05-30 07:44:45File_Modified_Date : UTC 2010-02-21 12:59:57File_Modified_Date_Local : 2010-02-21 07:59:57Encoded_Application : mkvmerge v2.0.2 ('You're My Flame') built on Feb 21 2007 23:40:55Encoded_Library : libebml v0.7.7 + libmatroska v0.8.1Encoded_Library/String : libebml v0.7.7 + libmatroska v0.8.1Cover : Yes

VideoUniqueID : 1Format : AVCFormat_Profile : [email protected]_Settings : CABAC / 8 Ref FramesCodecID : V_MPEG4/ISO/AVCDuration/String3 : 02:20:37.104Width : 1920Height : 800PixelAspectRatio : 1.000DisplayAspectRatio : 2.400FrameRate : 23.976ColorSpace : YUVChromaSubsampling : 4:2:0BitDepth : 8ScanType : ProgressiveDelay/String3 : 00:00:00.000Title : Letters From Iwo Jima (2006)Encoded_Library/Name : x264Encoded_Library/Version : core 55Encoded_Library_Settings : cabac=1 / ref=5 / deblock=1:-6:-6 / analyse=0x3:0x133 / me=umh / subme=7 / brdo=1 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=2 / deadzone=21,11 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=6546 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:0.3:15.0Language : en

Inspection: http://mediainfo.sourceforge.net/

AudioUniqueID : 881684881Format : DTSFormat/Info : Digital Theater SystemsCodecID : A_DTSDuration/String3 : 02:20:37.088BitRate_Mode : CBRBitRate : 1509750Channel(s) : 6ChannelPositions : Front: L C R, Side: L R, LFESamplingRate : 48000SamplingCount : 404980224Resolution : 24BitDepth : 24Delay/String3 : 00:00:00.000Delay_Source : ContainerStreamSize : 1592236701Title : Japanese DTS 5.1 (1.5mbps)Text #1UniqueID : 3861542542Format : ASSCodecID : S_TEXT/ASSCodecID/Info : Advanced Sub Station AlphaCodec : S_TEXT/ASSLanguage : en

Inspection: http://mediainfo.sourceforge.net/

Defining ‘Lossless’

QuicktimeQuicktime

DVDV PCMPCM

Raw Raw VideVideoo

losslelosslessssh264h264

MP4MP4

Original Quicktime: 125 MB

Resulting Lossless MP4: 187 MB

QuicktimeQuicktime

DVDV PCMPCM

Raw Raw VideVideoo

losslelosslessssh264h264

MP4MP4

Original Quicktime: 125 MB

Resulting Lossless MP4: 187 MB

Raw Decompressed Video: 512 MB

Defining ‘Lossless’

lossless process

codec=raw uyvy422, bitdepth=8, frameSize=720x486

1210 Megabytes / minute

codec=jpeg2000, bitdepth=8, frameSize=720x486

409 Megabytes / minute (encoded random video samples with openjpeg)

codec=ffv1, bitdepth=8, frameSize=720x486

354 Megabytes / minute (encoded random video samples with ffmpeg / libavcodec)

codec=dv50, bitdepth=8, frameSize=720x480

422 Megabytes / minute

Comparison of Data RatesAll scenario assume 29.97 fps, 4:2:2 and

stereo 16 bit, 48,000 kHz audio

Verifying ‘Lossless’

ffmpeg -i 5129-B04312_DV-PAL_720x576.mov -f framemd5 -an -Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '5129-B04312_DV-PAL_720x576.mov': Duration: 00:55:14.04, start: 0.000000, bitrate: 301 kb/s Stream #0.0(eng): Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 kb/ Stream #0.1(eng): Video: dvvideo, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 28800 kb/s, PAR 118:81 DAR 295:162, 25 fps, 25 tbr, 2500 tbn, 25 tbc Stream #0.2(eng): Data: tmcd / 0x64636D74Output #0, framemd5, to 'pipe:': Stream #0.0(eng): Video: rawvideo, yuv420p, 720x576 [PAR 118:81 DAR 295:162], q=2-31, 200 kb/s, 90k tbn, 25 tbcStream mapping: Stream #0.1 -> #0.0Press [q] to stop encoding0, 0, 622080, 9f7be428173e13d64a52ad75838b01230, 3600, 622080, e03f0dd12d7764100a201c378e732acc0, 7200, 622080, d6a0038f274dba8ce0a2e5b2015442900, 10800, 622080, a8dd7615d180b42a771cd071f1e37f160, 14400, 622080, 3c542b25edc7cf358c82400324f5f26e0, 18000, 622080, 41f456d4dae64dce0bf6dda30809d8550, 21600, 622080, 9018249d3224ecc89b474d97514220fd0, 25200, 622080, 1b9a03d8c21b5247f0f87c8d02b2542e0, 28800, 622080, 10214f13c0b7f18af715b359ed0263280, 32400, 622080, a7fa46bcff6ba19767d2587a8ec748770, 36000, 622080, c7e15c5a303755d759dfa6b0d99a69980, 39600, 622080, d2ff6b07d43d96296998e8be47a72ec80, 43200, 622080, 8a5477da7f834320e99b97b0642c2904

Verifying ‘Lossless’

ffmpeg -i 5129-B04312_DV-PAL_720x576_lossloss.mp4 -f framemd5 -t 0.5 -an -Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/daverice/Desktop/samples/5129-B04312_DV-PAL_720x576_lossloss.mp4': Duration: 00:00:32.96, start: 0.000000, bitrate: 45531 kb/s Stream #0.0(eng): Video: h264 (High 4:4:4 Predictive), yuv420p, 720x576 [PAR 118:81 DAR 295:162], 45467 kb/s, PAR 131:90 DAR 131:72, 25 fps, 25 tbr, 25 tbn, 50 tbcOutput #0, framemd5, to 'pipe:': Stream #0.0(eng): Video: rawvideo, yuv420p, 720x576 [PAR 131:90 DAR 131:72], q=2-31, 200 kb/s, 90k tbn, 25 tbcStream mapping: Stream #0.0 -> #0.0Press [q] to stop encoding0, 0, 622080, 9f7be428173e13d64a52ad75838b01230, 3600, 622080, e03f0dd12d7764100a201c378e732acc0, 7200, 622080, d6a0038f274dba8ce0a2e5b2015442900, 10800, 622080, a8dd7615d180b42a771cd071f1e37f160, 14400, 622080, 3c542b25edc7cf358c82400324f5f26e0, 18000, 622080, 41f456d4dae64dce0bf6dda30809d8550, 21600, 622080, 9018249d3224ecc89b474d97514220fd0, 25200, 622080, 1b9a03d8c21b5247f0f87c8d02b2542e0, 28800, 622080, 10214f13c0b7f18af715b359ed0263280, 32400, 622080, a7fa46bcff6ba19767d2587a8ec74877

QuickTime™ and aH.263 decompressor

are needed to see this picture.

http://en.wikipedia.org/wiki/Execution_of_Saddam_Hussein

Time and place of execution

Saddam was executed by hanging at approximately 06:00 local time (03:00 GMT) on December 30, 2006, the day Sunni Iraqis begin celebrating Eid ul-Adha.[4][5][6] Reports conflict as to the exact time of the execution, with some sources reporting the time as 06:00, 06:05, or some, as late as 06:10.[4][6][7] The execution took place at the joint Iraqi-American military base Camp Justice, located in Kazimain, a north-eastern suburb of Baghdad. Camp Justice was previously used by Saddam as his military intelligence headquarters, then known as Camp Banzai, where Iraqi civilians were taken to be tortured and executed on the same gallows. Contrary to initial reports, Saddam was executed alone, not at the same time as his co-defendants Barzan Ibrahim al-Tikriti and Awad Hamed al-Bandar, who were executed on January 15, 2007.

QuickTime™ and aH.263 decompressor

are needed to see this picture.

http://en.wikipedia.org/wiki/Execution_of_Saddam_Hussein

Time and place of execution

Saddam was executed by hanging at approximately 06:00 local time (03:00 GMT) on December 30, 2006, the day Sunni Iraqis begin celebrating Eid ul-Adha.[4][5][6] Reports conflict as to the exact time of the execution, with some sources reporting the time as 06:00, 06:05, or some, as late as 06:10.[4][6][7] The execution took place at the joint Iraqi-American military base Camp Justice, located in Kazimain, a north-eastern suburb of Baghdad. Camp Justice was previously used by Saddam as his military intelligence headquarters, then known as Camp Banzai, where Iraqi civilians were taken to be tortured and executed on the same gallows. Contrary to initial reports, Saddam was executed alone, not at the same time as his co-defendants Barzan Ibrahim al-Tikriti and Awad Hamed al-Bandar, who were executed on January 15, 2007.

mediainfo saddam.3gp GeneralFormat profile : 3GPP Media Release 4File size : 1381144Encoded date : 2006-12-30 06:11:47VideoFormat : H.263Format profile : [email protected] : 00:02:37.127Width : 176Height : 144Frame rate mode : VariableFrame rate : 6.186 fpsCompression mode : Lossy

Thanks

More information which we won't be able to address during the presentation...

How? - Solutions for transcoding

Early NLEs were concerned only with ingesting from video tape and outputting back to tape.Creating video that's only for watching on a computer is relatively new.Other tools for transcoding began to pop up and eventually NLEs added that functionality – although it can be a bit kludgy.

How – What to shop for? Inputs and outputs variety of video formats but make sure they can handle

the formats that you need. Pro packages are mostly aimed towards content providers (TV networks,

etc.) Basic/home user packages are aimed towards converting for internet, iPod, mobile device use – less features.

Batch processing is a must. “Set it and forget it” Since transcoding can be very processor/time-intensive, letting a computer render overnight or during the weekend is very useful.

Be aware of the licensing. Some programs limit the amount and types transcoding you can do to make you buy a more professional package.

Watermarking, burn in time code, etc.

Transcoding with Final Cut Pro/Premiere/After Effects,

etc. Most non-linear editors have the ability to import one video format and

export to another. Tend to be the most expensive solutions with lots of overhead. If you don't need the other tools of an NLE, don't buy one just to transcode.

It's overkill and maybe not the best solution. These programs are not always the archivists friend. Some NLEs do

transcoding shortcuts and don't easily allow you to tweak the parameters.

Some professional transcoding tools

Apple Compressor (Mac, $1000) Grass Valley Procoder (Windows, $500) Sorenson Squeeze (Mac & Windows, $800) Telestream Episode (Mac & Windows, $500) Telestream FlipFactory (Windows, $5500)

Hardware/Software SolutionsSome digitizing cards have software to transcode. Some hardware speeds up

the transcoding process with chips that have been optimized for certain codecs.

Digital Rapids Stream (lite version bundles with same hardware as SAMMA Solo)

Elgato Turbo h264 Matrox Compress HD

Cheap/Free Solutions● Quicktime Pro ($20, plus $20 if you wish to play/process MPEG2) Don't use Quicktime X – it suX!● VLC (free) http://www.videolan.org/● MPEG Streamclip (free) http://www.squared5.com ● Ffmpeg (free) http://www.ffmpeg.org/● mplayer● Scores of utilities that provide a GUI for ffmpeg. Some are better than others (SUPER, ffmpegx, etc.)

WARNING – Common mistakes Going from a lower bitrate to higher bitrate video While it may be necessary to upsample the video for editing (SD video in an HD production) it shouldn't be done for preservation

migration, since. Files are bigger, but no quality is gained. With DV, you could be losing important implicit metadata (timestamps,

error information, camera/exposure info) and even audio tracks Interlacing. If the access file is never going to be shown on a TV, the file

should be deinterlaced. Quality is lessened but the annoying combing effect also goes

Questions?Skip ElsheimerA/V Geeks LLC

[email protected]://www.avgeeks.com