Script checking internet restriction with FFmpeg

CK CK 3788 
Created at
Updated at  
683 0 0

Sometimes, you may face your FFmpeg not loading internet resources as planned. In my case, I found the case, FFmpeg can't load redirected internet object such as ts or m3u8. The below script will help you to check what kind of issues are happening in the system, so you can fix its root cause.

#!/bin/bash

echo "=============================================="
echo "  Checking FFmpeg URL Redirection Restrictions"
echo "=============================================="

# 1. Check iptables rules for HTTP/HTTPS blocking
echo -e "\n[+] Checking iptables rules..."
if sudo iptables -L -v -n | grep -E "REJECT|DROP" | grep -E "80|443"; then
    echo "⚠️  iptables is blocking HTTP/HTTPS traffic!"
else
    echo "✅ No HTTP/HTTPS blocks in iptables."
fi

# 2. Check firewalld rules
echo -e "\n[+] Checking firewalld rules..."
if sudo firewall-cmd --list-all | grep -E "block|reject"; then
    echo "⚠️  firewalld is blocking some traffic!"
else
    echo "✅ No blocking rules in firewalld."
fi

# 3. Check /etc/hosts for blocked domains
echo -e "\n[+] Checking /etc/hosts for blocked domains..."
if grep -E "0.0.0.0|127.0.0.1" /etc/hosts | grep -v "localhost"; then
    echo "⚠️  Some domains might be blocked in /etc/hosts!"
else
    echo "✅ No domain blocking in /etc/hosts."
fi

# 4. Check sysctl for ICMP redirects
echo -e "\n[+] Checking sysctl ICMP redirect settings..."
if sysctl -a 2>/dev/null | grep "accept_redirects" | grep "= 0"; then
    echo "⚠️  ICMP redirects are disabled!"
else
    echo "✅ ICMP redirects are enabled."
fi

# 5. Check SELinux status
echo -e "\n[+] Checking SELinux status..."
selinux_status=$(getenforce)
if [ "$selinux_status" == "Enforcing" ]; then
    echo "⚠️  SELinux is Enforcing. It might restrict FFmpeg!"
else
    echo "✅ SELinux is not enforcing."
fi

# 6. Check dnsmasq blocking
echo -e "\n[+] Checking dnsmasq for blocked domains..."
if [ -f /etc/dnsmasq.conf ]; then
    if grep "address=" /etc/dnsmasq.conf; then
        echo "⚠️  Some domains are blocked via dnsmasq!"
    else
        echo "✅ No domain blocking in dnsmasq."
    fi
else
    echo "✅ dnsmasq is not configured."
fi

# 7. Test FFmpeg URL redirection
echo -e "\n[+] Testing FFmpeg URL redirection..."
ffmpeg_output=$(ffmpeg -v debug -i "http://redirecting-site.com/video.mp4" 2>&1)
if echo "$ffmpeg_output" | grep -q "301 Moved Permanently\|302 Found"; then
    echo "✅ FFmpeg can follow redirects."
else
    echo "⚠️  FFmpeg redirection might be blocked!"
fi

echo -e "\n✅ Scan Completed!"

You should change redirecting-site.com/video.mp4 to your target URL.

The above script is tested on CentOS 7. You can save it as ffmpeg_check_internet_restrictions.sh:

sh ffmpeg_check_internet_restrictions.sh
Tags FFmpeg FFmpeg internet restrictions URL Redirection Facebook X
Comments 0
Similar posts
  1. FFmpeg compile options based on configure
    1,111
  2. FFmpeg compile option to support SCTE-35
    838
  3. How do I create animated background for Google Meet?
    20,611
  4. Secure HLS encoding using AES-128 encryption with FFmpeg
    1,131
  5. FFmpeg CLI to remove audio track from MP4
    542
  6. FFmpeg CLI to mix two different audios in a single audio file such as mp3
    603
  7. FFmpeg CLI to merge a video only mp4 and mp3 audio file
    334
  8. FFmpeg CLI to convert a video file to an MP3 audio file
    348
  9. How to redirect browser in PHP ?
    486
  1. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  2. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  3. From SDI to MXL: Inside the Cloud-Native Infrastructure Powering Next-Gen Live Broadcast
    570
  4. Smooth switching with EXT-X-DISCONTINUITY in HLS
    432
  5. Disabling Audio Tracks in HLS.js
    376
  6. A Deep Dive Into Internet Advertising Ecosystem on Video Streaming Industry
    645
  7. When to use #EXT-X-DISCONTINUITY in HLS?
    1,428
  8. A prefect Apache server settings to avoid CORS error for HLS
    604
  9. CloudFront Settings for Dynamic HLS Streaming
    650
  10. SafeFrame is a web standard developed by IAB
    507
  11. CSAI vs SSAI
    576
  12. Ad Marker: SCTE-35 Message Encoder based in Python
    797
  13. Ad marker: SCTE-35 enhanced
    574
  14. FFmpeg compile options based on configure
    1,111
  15. FFmpeg compile option to support SCTE-35
    838
  16. HTTP Proxy when your URL access is blocked with FFmpeg
    1,897
  17. Limit Maximum Resolution in HLS.js
    664
  18. Magic line when HLS video manifest is mixed with encrypted / unencrypted video chunks
    1,461
  19. Recovering a crashed HLS.js player
    1,279
  20. How do I create animated background for Google Meet?
    20,611
  21. Secure HLS encoding using AES-128 encryption with FFmpeg
    1,131
  22. Machine Learning Models for Ad Detection from a Video Stream
    188
  23. Unlock Flawless HLS Audio Sync: The Power of #EXT-X-INDEPENDENT-SEGMENTS
    375
  24. NVIDIA CUDA library which can be integrated with C/C++
    376
  25. Approaches to Scene Detection in Video Processing
    645
  26. FFmpeg CLI to remove audio track from MP4
    542
  27. Building GPU as a Service aka Dockerized GPU
    1,575
  28. IAB Categories (a.k.a. OpenRTB Code)
    1,013
  29. FFmpeg library that can be directly integrated into C/C++/Rust/Python without CLI
    2,068
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    40
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    34
  3. How do I create animated background for Google Meet?
    20,611
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    244
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    157
  7. Array of arguments passed to script in PHP
    90
  8. Invalid Auction Storms in Ad Tech
    98
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  10. The Two Clocks of Ad Server Architecture
    70
  11. Frequency Cap Architecture Overview
    514
  12. Collecting Proof-of-Play from 100,000 Screens
    146
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    287
  14. What is RedisVL?
    109
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    230
  16. TPU & GPU Cluster Management Tools
    243
  17. The Concept of Scaffolding in AI Agents
    233
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    583
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    258
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    339
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  22. Machine Learning: Training vs. Ranking
    221
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  25. Designing a Data Curation System Around a Vector Database
    220
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    656
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    195
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    217
  30. Understanding Data Lineage
    260