Yes, you can perform a test encode for just 1 minute of each file by modifying the FFmpeg command to only process the first 60 seconds. In FFmpeg, you can use the -t 60 option to limit the output duration to 60 seconds.
Here's how you can do it concisely:
- Add '-t', '60' to the FFmpeg command list in the encode_dvr function, right after the input file argument.
Would you like this as a permanent option (e.g., via a command-line flag or prompt), or just a quick hardcoded test for now? If you want it as a toggle, let me know your preferred method (prompt, argument, etc.). Otherwise, I can make the quick change for a 1-minute encode.
Yes, you should wait! The output shows that FFmpeg is still processing and hasn't actually gotten stuck. Here's what's happening:
1.**Frame 898** - FFmpeg is still encoding frames (you're at frame 898)
2.**fps=3.1** - It's processing about 3.1 frames per second, which is normal for lossless VP9 encoding
3.**size=176384KiB** - The output file is growing (about 172MB so far)
4.**time=N/A** - This is normal during encoding, especially with lossless encoding
5.**speed=N/A** - Also normal during lossless encoding
The key indicators that it's working:
- Frame count is increasing (898 frames processed)
- File size is growing (176384KiB)
- No error messages
- The final lines show "All streams finished" and "Terminating thread with return code 0 (success)"
**Lossless VP9 encoding is very slow** - 3.1 fps is actually quite good for lossless encoding. A 15-second clip might take several minutes to encode losslessly.
The 300-400 Mbps network activity you're seeing is likely the input file being read from the network share, which is normal.
**Recommendation**: Let it finish. The process appears to be working correctly, just slowly (which is expected for lossless encoding).
That output means **the encoding is complete and successful!**
The messages you're seeing:
-`All streams finished` - FFmpeg has finished processing all video and audio streams
-`Terminating thread with return code 0 (success)` - The process completed successfully with no errors
The fact that your CPU is no longer being utilized confirms this - FFmpeg has finished the encoding job and is just cleaning up.
**The process should exit automatically** and return you to the command prompt. If it's still showing those messages repeatedly without exiting, that might indicate the script is stuck in a loop reading the output.
You can:
1.**Wait a few more seconds** - it might just be finishing up
2.**Press Ctrl+C** if it doesn't exit - the encoding is already done
3.**Check your output folder** - the encoded file should be there
The 15-second test encode is complete! You should find the output file in your `output/` directory.
FFmpeg might still be accessing files for several reasons even after the encoding is "complete":
1.**Finalizing the output file** - Writing the final metadata, headers, and closing the file properly
2.**Cleanup operations** - Releasing file handles, flushing buffers to disk
3.**Network share overhead** - If writing to a network location, there might be additional I/O for file locking, permissions, or network protocol cleanup
4.**File system operations** - Updating timestamps, file attributes, or directory entries
5.**Buffer flushing** - Ensuring all data is actually written to disk before closing
The "All streams finished" message indicates the encoding work is done, but FFmpeg still needs to:
- Write the final file headers
- Close the output file properly
- Release system resources
This is normal behavior, especially when working with network shares where file operations can take longer due to network latency and protocol overhead. The process should exit once all file operations are complete.
If it's taking an unusually long time (>30 seconds), you could check if there are any file system issues or network connectivity problems.
Yes! The issue is that you're using lossless VP9 encoding, which creates very large files. VP9 doesn't have a traditional "CQ 0" option like H.264/H.265, but you can use **CRF (Constant Rate Factor)** which is similar.
For VP9, the CRF range is **0-63**, where:
- **0** = lossless (what you're currently using)
- **10-20** = visually lossless (very high quality)
- **20-30** = high quality
- **30+** = lower quality
Let me modify the script to use CRF instead of lossless:
- **Removed `-lossless 1`** - This was causing the massive file sizes
- **Added `-crf 15`** - High quality, visually lossless setting
- **Added `-b:v 0`** - Let CRF control the bitrate automatically
- **Changed `-cpu-used` from 0 to 2** - Faster encoding while maintaining quality
**CRF values you can try:**
- **10** - Very high quality (larger files)
- **15** - High quality (good balance)
- **20** - Still high quality (smaller files)
- **25** - Good quality (much smaller files)
The current setting of CRF 15 should give you excellent quality with much smaller file sizes than lossless. You can adjust the CRF value based on your quality vs. size preferences.
Yes! To test the full video lengths, you just need to remove the `-t 1` parameter from the FFmpeg command. This will encode the entire duration of each video.
Perfect! Now the script will encode the full duration of each video. With your current settings:
- **CRF 15** - High quality, visually lossless
- **Max bitrate 10 Mbps** - Good for 1080p content
- **CPU-used 2** - Reasonable encoding speed
The encoding will take much longer now (probably 10-30 minutes per video depending on your hardware), but you'll get the full videos encoded with good quality and reasonable file sizes.
You can run the script now and it will process all 14 files in your input directory with their full durations.