KABUL, Afghanistan — The Taliban seem loose, almost offhand, on camera as they wait for the American Black Hawk to land. Two fighters walk their hostage, Sgt. Bowe Bergdahl, out to American troops, greeting their enemies eye to eye as they quickly shake hands. They wave as the Americans retreat back to the chopper.

In their viral video to the world on Wednesday, framing dramatic images of their transaction with the United States with music, commentary and context, the Taliban scored their biggest hit yet after years of effort to improve their publicity machine — one bent on portraying them as the legitimate government of Afghanistan in exile.

Within hours of the video’s release, the Taliban website where it was posted was overwhelmed with traffic and the page hosting it crashed, according to Zabiullah Mujahid, a spokesman for the insurgents. The video has since been uploaded in dozens of different versions on YouTube.

It is the product of a Taliban propaganda effort that has grown increasingly savvy.

In recent years, the Taliban have tried to score points by insisting that they, unlike their Pakistani militant counterparts, actively supported polio vaccinations. Two months ago, realizing that they had outraged the Afghan public with an attack by gunmen on the Serena Hotel in Kabul that left children among the dead, the Taliban issued their first public apology. And they suggested that they had purposefully held back on attacking civilians on election day in April, and that Afghans should trust the Taliban over a government being chosen by Western ways.